in reply to Baffled by DateTime
UTC is indeed the default time zone.
$ perl -Mv5.14 -e'use DateTime; say DateTime->now->time_zone->name' UTC
It's also in the documentation.
For local time, use
my $now = DateTime->now( time_zone => 'local' );
All of these could be considered EST5EDT:
| Name (bold) and Aliases | Location observed |
|---|---|
| America/New_York US/Eastern | US, most areas of many states |
| America/Detroit | US, MI, most areas |
| America/Indiana/Indianapolis America/Fort_Wayne America/Indianapolis | US, IN, most areas |
| America/Indiana/Marengo | US, IN, Crawford |
| America/Indiana/Petersburg | US, IN, Pike |
| America/Indiana/Vevay | US, IN, Switzerland |
| America/Indiana/Vincennes | US, IN, Da/Du/K/Mn |
| America/Indiana/Winamac | US, IN, Pulaski |
| America/Kentucky/Louisville America/Louisville | US, KY, Louisville area |
| America/Kentucky/Monticello | US, KY, Wayne |
| America/Toronto America/Montreal America/Thunder_Bay America/Nipigon America/Nassau | CA, ON CA, QC BS |
| America/Iqaluit America/Pangnirtung | CA, NU |
| America/Grand_Turk | TC |
| America/Port-au-Prince | HT |
(WTF Indiana? That's not even including the parts of Indiana that couldn't be considered EST5EDT!)
Assuming you mean the US Eastern Time, use the following instead
my $now = DateTime->now( time_zone => 'America/New_York' );
Or if you prefer the alias,
my $now = DateTime->now( time_zone => 'US/Eastern' );
|
|---|