[San-Diego-pm] Converting Time from UTC

Mark Schoonover mark.schoonover at gmail.com
Fri Feb 1 17:39:04 PST 2008


Yeah, that's what I was thinking on the way home tonight... I was thinking I
could just check the date/time to see if it's equal to, or past March 9th,
0200 and go that route, but I think it maybe safer to use DateTime module to
do what I need.

Thanks for the help Chris. I do appreciate it...

On Feb 1, 2008 7:49 PM, Chris Radcliff <chris_radcliff at mac.com> wrote:

> If I'm understanding your situation correctly, you should be able to join
> the date and time strings with a space, then pass the combined string into
> parse_datetime().
>
> On Feb 1, 2008, at 4:21 PM, Mark Schoonover wrote:
>
> Thanks Chris. The problem I'm having is creating the $string to begin
> with. I've been banging my head on this all day today reading cpan, so it's
> probably something very obvious I'm now too toasted to see... This does look
> like what I'll need to do.
>
> On Feb 1, 2008 3:57 PM, Chris Radcliff <chris_radcliff at mac.com> wrote:
>
> > Hi Mark,
> >
> > There may be a DateTime formatter module that includes your particular
> > format. For example:
> >
> >
> > http://search.cpan.org/~schubiger/DateTime-Format-Natural-0.66/lib/DateTime/Format/Natural.pm<http://search.cpan.org/%7Eschubiger/DateTime-Format-Natural-0.66/lib/DateTime/Format/Natural.pm>
> >
> > There are many to choose from, so you might want to try a few and see
> > which one does the best (and possibly fastest) job. Each one will let
> > you go straight from a string to a DateTime object:
> >
> > my $parser = DateTime::Format::Natural->new();
> > my $dt = $parser->parse_datetime($date_string);
> >
> > ...and from there you can use DateTime functions as you described.
> > Hope that helps.
> >
> > Cheers,
> > ~chris
> >
> > On Feb 1, 2008, at 3:42 PM, Mark Schoonover wrote:
> >
> > > Good Afternoon PMs!
> > >
> > > I'm trying to convert from UTC to various US timezones. The time
> > > data is recorded in UTC in a CSV file. What I need to do is convert
> > > that time to the correct US timezone, plus keep in my daylight
> > > savings time. I've looked at DateTime, and it will do what I need,
> > > but I'm missing something basic. My time is not broken out by hms
> > > seperately, but instead is recorded 00:00 in one field, and mm/dd/
> > > yyyy in another. I've played around with DateTime, which has an
> > > is_dst method, but I have no idea how to put the date and time into
> > > the correct format, and have it create a DateTime object so I can
> > > convert to the correct timezone.
> > >
> > > Any ideas?
> > >
> > > TIA
> > >
> > > --
> > > Mark Schoonover, CMDBA
> >
>
>


-- 
Mark Schoonover, CMDBA
http://www.linkedin.com/in/markschoonover
http://marksitblog.blogspot.com
mark.schoonover at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/san-diego-pm/attachments/20080201/2bfea2a0/attachment-0001.html 


More information about the San-Diego-pm mailing list