See DateTime and DateTime::Format::Strptime.
use DateTime::Format::Strptime qw(); print DateTime::Format::Strptime ->new( locale => 'en', pattern => '%a %b %d %T %Y', on_error => 'croak', )->parse_datetime('Fri Jun 16 18:04:03 2012') ->strftime('%m %d %T %Y'); # '06 16 18:04:03 2012'
2012-06-16 was a Saturday, not a Friday. If you regularly get wrong weekdays in your input datetime stamps, remove the pattern %a, it will work fine without it. If you can change the output format, please use a standard format such as DateTime::Format::RFC3339 instead! This will increase interoperability.
use DateTime::Format::RFC3339 qw(); use DateTime::Format::Strptime qw(); print DateTime::Format::RFC3339 ->new ->format_datetime(DateTime::Format::Strptime ->new( locale => 'en', pattern => '%a %b %d %T %Y', on_error => 'croak', )->parse_datetime('Fri Jun 16 18:04:03 2012') ); # '2012-06-16T18:04:03+00:00'

In reply to Re: Conversion of Time by daxim
in thread Conversion of Time by PRS

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.