Re: what would this look like in Perl6...

First of all you wouldn't do this in Perl6 if you could help it! You would just use the built in core DateTime object and then use the attributes on that object to get the bits of the date and time you want >;3 If you grab yourself a copy of Rakudo the following works from the command line REPL:

$ perl6 > my $time = DateTime.new(time) 2014-11-05T22:35:54Z > $time.^methods check-time now clone clone-without-validating Instant posix offset off +set-in-minutes offset-in-hours later earlier truncated-to whole-secon +d in-timezone utc local Date Str IO is-leap-year days-in-month daycou +nt-from-ymd ymd-from-daycount get-daycount day-of-month day-of-week w +eek week-year week-number weekday-of-month day-of-year check-value ch +eck-date truncate-parts new perl gist <anon> <anon> <anon> <anon> <an +on> <anon> <anon> <anon> > $time.^attributes Int $!year Int $!month Int $!day Int $!hour Int $!minute Mu $!second M +u $!timezone Callable &!formatter > say $time.month 11 >

DateTime.new(time) above is the current local time as an object. Just time on its own gives you an Int as the system epoch timestamp in seconds. Calling ^methods on anything gives you a list of the methods an object has which is useful for picking up Perl6, ^attributes is similarly useful and makes it fairly obvious what you can get at in DateTime.


In reply to Re: localtime parse within hash init by Ultimatt
in thread localtime parse within hash init by NetWallah

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.