On Nov 4, Scott Taylor said:

I have a date in UT that looks like this:
"2005-11-02 01:36:00.0"

Can anyone tell me the best way to subtract 8 hours from it, or to convert
it to PDT?

I'm reading up on Date::Manip, but I don't know if that is going to help,
yet.

Date::Manip can probably do it, and it can also cook you a three-course meal and help you find your wallet. For a slightly lighter-weight solution, consider the simple Date::Parse (which comes with Perl). It can handle the format you've provided:

  use Date::Parse;
  my $gmtime = str2time("2005-11-02 01:36:00.0", "UTC");

Now you have the number of seconds in $gmtime. Subtract 8 hours by subtracting 60*60*8 seconds from that.

--
Jeff "japhy" Pinyan        %  How can we ever be the sold short or
RPI Acacia Brother #734    %  the cheated, we who for every service
http://www.perlmonks.org/  %  have long ago been overpaid?
http://princeton.pm.org/   %    -- Meister Eckhart

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


  • Dates Scott Taylor
    • Re: Dates Jeff 'japhy' Pinyan
    • RE: Dates Timothy Johnson

Reply via email to