[pm-h] DateTime snippets
Julian Brown
julian at jlbprof.com
Fri Sep 11 10:46:27 PDT 2015
FYI here is the project I used in the talk.
Julian
On Fri, Sep 11, 2015 at 7:26 AM, G. Wade Johnson via Houston <houston at pm.org
> wrote:
> After the discussion on Julian's time series code, I dug out some
> pieces of DateTime logic I've used. These may be useful for some.
>
> my $LocalTZ = DateTime::TimeZone->new( time_zone => 'local' );
>
> This variable can be passed any time DateTime needs a time zone.
> Obviously, you can build other DateTime::TimeZone objects for other
> time zones that you need.
>
> $dt->add( days => 1 ); # Move forward one day
> $dt->subtract( days => 1 ); # Move backward one day
>
> These change the $dt object, but other than that are pretty useful. See
> DateTime::Duration for other arguments you can use.
>
> I haven't tried it, but
>
> $dt->truncate( to => 'day' );
>
> Should truncate the $dt to midnight. Other values for 'to' truncate at
> other spots.
>
> HTH,
> G. Wade
> --
> Results are what you wanted, consequences are what you got.
> -- Michael VanDusen
> _______________________________________________
> Houston mailing list
> Houston at pm.org
> http://mail.pm.org/mailman/listinfo/houston
> Website: http://houston.pm.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/houston/attachments/20150911/d88d03c9/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DateTimeTalk.tgz
Type: application/x-gzip
Size: 2793200 bytes
Desc: not available
URL: <http://mail.pm.org/pipermail/houston/attachments/20150911/d88d03c9/attachment-0001.tgz>
More information about the Houston
mailing list