Created
March 15, 2013 08:51
-
-
Save hamakn/5168436 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use 5.016; | |
use DateTime; | |
# beginning_of_day | |
say DateTime->now( time_zone=>'local' )->truncate( to => "day" )->strftime('%Y/%m/%d %H:%M:%S') | |
# => 2013/03/15 00:00:00 | |
# サマータイムで存在しない時刻を指定すると例外 | |
# (America/Chicago時刻では、2003-04-06 01:59:59 の次は 2003-04-06 03:00:00) | |
DateTime->new( time_zone => 'America/Chicago', year => 2003, month => 4, day => 6, hour => 2, minute => 0, second => 0 ); | |
# => Invalid local time for date in time zone: America/Chicago |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment