The suntime function calculates the Coordinated Universal Time (UTC) or local time for a given sun position and geographic location according to DIN EN 17037. The default geographical settings are set in the file “LT_location.mat”. Change the settings to your preferred location and set the file to read-only in order to prevent your settings from being overwritten with the default values in future versions.


[utc,lct] = suntime(day,coord,target,value)


utcReturns the Coordinated Universal Time (UTC)
Returns the local time, offset to UTC is defined in LT_location.mat file.
daySpecifies the date in ‘DD.MM.YYYY’ format.
coordSpecifies the geographic coordinates, default is defined in LT_location.mat file, default Berlin: [13.326 52.514].
targetSpecifies the target angle:
'gamma1' = sun elevation angle: \gamma (first time)
'gamma2' = sun elevation angle: \gamma (second time)
'azimuth' = azimuth angle: \alpha
'sunrise' = sunrise (\gamma = -0.833)
'sunset' = sunset (\gamma = -0.833)
valueSpecifies the target value. Note: for sunrise and sunset the value is automatically set to -0.833.


UTC for sun position \alpha = 90° at 13.05.2022 in Berlin:

utc = suntime('13.05.2022',[],'azimuth',90)


utc = 06:01:31

UTC and local time for sunset at 13.05.2022 in Berlin:

[utc,localtime] = suntime('13.05.2022',[],'sunset')

See also: sunset


utc = 18:51:05
localtime = 20:51:05

UTC for sun positions \gamma_1 = 20° at 18.07.2021 in Athens:

utc = suntime('13.05.2022',[37.978 23.728],'gamma1',20)


utc = 14:26:51


DIN EN 17037:2019-03: Daylight in buildings. 2019.

Leave a comment

* I accept the use of cookies as well as the terms in the privacy policy. I accept that data provided by me is processed and saved. I know that comments are saved and published after review.