How do i get the current time of a different time zone? Example, i need to know the current time in Singapore where as my system is set to PT time.
GMT is the way to go. (I'm speaking at somebody in the US, so it isn't a matter of it being my time zone.)
David Thornley
2010-07-27 21:10:15
How to handle day saving time(PDT/PST)?
Prabhu Jayaraman
2010-07-28 01:42:00
You're going to have to provide quite a bit more context if you want a more specific answer. What's your operating system? Platform? Library set?
Nathon
2010-07-28 11:44:07
+1
A:
Use UTC (GMT) as much as possible.
If you need to (for example) print a report that's going to another time zone, use something like SystemTimeToTzSpecificLocalTime() to localise it.
Michael J
2010-07-28 18:14:58
+1
A:
One implementation would be to use time
to get the current time in UTC and then manipulate the TZ
environment variable to your destination timezone. Then use localtime_r
to convert to that timezone's local time.
Mark B
2010-07-28 18:28:59