KevinR
Veteran
May 29, 2008, 12:30 AM
Post #2 of 2
(1946 views)

the easiset way to add or subtract time is using the epoch. If you do this: the return value is the epoch, which is the number of seconds since a certain date in the past, which is a little different for different computers but that does not matter for adding or subtracting small amounts of time from the current time. To subtract one hour: Why 3600? Becuase that is the number of seconds in one hour: 60 seconds X 60 minutes X 1 hour. To subtract 8 hours just multiply 3600 by 8: $time = time  (3600 * 8); print scalar localtime($time); 
