I need to find out what is local time at a given location. I have GMT/UTC offset for that location. I am trying to get a time duration by taking a difference between deadline set in that time zone to trigger emails being sent out when deadline is met in that perticular time zone.
Ex.If deadline is set in Seattle to be Sept 10, 2011 12:00:00 GMT -7:00 now if I am in UK I need to calculate what time is now in Seattle given GMT offset -7:00 once I get that I can calculate the difference if the difference is 0 then I will sent out an email saying deadline is met.
How can I do the time calculation part in Perl?
Please help.
Thanks,
Sunyl
Create a DateTime object, and compare it to
DateTime->now. The DateTime object is aware of the time zone associated with the timestamp therein, so it can do what you want with no fuss.Above, I assumed you miscopied the date format. If the date is formatted as you provided, you won’t be able to use Strptime because the timestamp uses nonstandard names for the months and a nonstandard format for the offset.