Browse - Programming Tips - What's an easy way to display the time?
Q. What's an easy way to display the time?
A. If you aren't picky about the exact way it looks, use asctime() like this:
# Required to use asctime().
# But every installation is going to have this.
# Obtain the current time.
# Or you could use a file's modify time, etc.
my $time = time();
# Convert the time to the local timezone with localtime().
# Format it with asctime().
# Then print it.
Sun Mar 18 06:27:28 2012