John Bruin wrote:
I have a list of dates that have been converted to epoch seconds,
processed and then converted back to a string (using timelocal).
The resulting date format is:-

"Wed Mar 16 22:10:16 2004"

What is the easiest way to convert this format (or epoch seconds)
to "16-Mar-2004 22:10" -

The easiest way, I suppose, is to use epoch seconds as the starting point and use some module. Pick one and give it a try.

Alternatively, the string is easily converted with the s/// operator:

    s[\w{3}\s+(\w{3})\s+(\d{1,2})\s+(\d\d:\d\d):\d\d\s+(\d{4})]
     [$2-$1-$4 $3]

preferrably using a standard module as I don't have administrator
rights.

If you don't have root access, modules can be installed in a local library.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to