Converting UTC sunrise and sunset values to Local Time

Converting UTC sunrise and sunset values to Local Time

egarden_fenestrapro_com
Contributor Contributor
1,035 Views
3 Replies
Message 1 of 4

Converting UTC sunrise and sunset values to Local Time

egarden_fenestrapro_com
Contributor
Contributor

Hello there,

 

I guess that there's a reason it's not exposed by the API, but would anyone know (or be able to point me in the direction of) the conversion steps or calcs necessary to get from the UTC sunrise and sunset DateTime values returned by the GetSunrise & GetSunset methods to the correct local time?

 

I haven't had much luck with the solutions found via Google..

 

Thanks in advance for your time,

Edwin

 

0 Likes
Accepted solutions (1)
1,036 Views
3 Replies
Replies (3)
Message 2 of 4

jeremytammik
Autodesk
Autodesk
Accepted solution

Dear Edwin,

 

I would assume that the reason the Revit API does not expose anything related to this is because it is completely independent of Revit and the BIM, and the generic .NET API and libraries provide ample support for it.

 

I see lots of useful results searching for ".net c# convert datetime utc local":

 

https://duckduckgo.com/?q=.net+c%23+convert+datetime+utc+local

 

I hope this helps.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 4

egarden_fenestrapro_com
Contributor
Contributor

Hello Jeremy,

 

Well, that's embarrasing.. I was looking at all sorts of calculations to get from UTC to local solar time etc. etc., missing the obvious.

 

The first StackOverflow answer from your list did the job.

 

Thanks for getting back though! It's appreciated.

 

Regards,

Edwin

0 Likes
Message 4 of 4

jeremytammik
Autodesk
Autodesk

Dear Edwin,

 

No reason for embarassment, no such thing as a silly question!

 

Thank you for your appreciation.

 

Very glad it helped.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes