in reply to Output of Date

Esteemed Anonymous Monk, our most prolific and inquisitive of brethren,

I've been advocating the use of strftime at work to prevent the continual hand rolling and re-rolling of customized time functions.

This one prints the current local time in YYYY/MM/DD HH:MM:SS format:

use POSIX; print strftime("%Y/%m/%d %H:%M:%S", localtime),"\n";
If you are given the time in epoch seconds try this:
use POSIX; print strftime("%A, %B %d, %Y", localtime($epoch)),"\n";
which will output "Day of week, Month DD, YYYY". Check the Perl documentation for POSIX (perldoc POSIX) and if you are on UNIX you can also do a "man strftime" to get a good description of the format qualifiers.

Good luck,
{NULE}
--
http://www.nule.org

Replies are listed 'Best First'.
Re: Re: Output of Date
by Anonymous Monk on May 13, 2002 at 14:56 UTC
    Thanks to all for your answers!