tags:

views:

65

answers:

3

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.

A: 

You could convert to GMT then convert to whatever time zone you want.

Nathon
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
How to handle day saving time(PDT/PST)?
Prabhu Jayaraman
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
+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
+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