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 AliasesLocation observed
America/New_York
US/Eastern
US, most areas of many states
America/DetroitUS, MI, most areas
America/Indiana/Indianapolis
America/Fort_Wayne
America/Indianapolis
US, IN, most areas
America/Indiana/MarengoUS, IN, Crawford
America/Indiana/PetersburgUS, IN, Pike
America/Indiana/VevayUS, IN, Switzerland
America/Indiana/VincennesUS, IN, Da/Du/K/Mn
America/Indiana/WinamacUS, IN, Pulaski
America/Kentucky/Louisville
America/Louisville
US, KY, Louisville area
America/Kentucky/MonticelloUS, 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_TurkTC
America/Port-au-PrinceHT

(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' );

In reply to Re: Baffled by DateTime by ikegami
in thread Baffled by DateTime by BernieC

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.