in reply to How can i add 2 hours to localtime?

Most of the answers given so far say "Just add 7200 seconds" to the local time as expressed in seconds since the epoch. What all of these solutions fail to mention is that it breaks when daylight saving time (DST) is nigh. Modules such as Date::Calc and DateTime however have facilities to handle the discrepancy. Alternatively you can do all of your math in GMT time (which doesn't have DST) and then convert to localtime at the end.

  • Comment on Re: How can i add 2 hours to localtime?