################################################## # NiceDate.pm -- Print the date in a nice format ################################################## package NiceDate; use strict; use warnings; our $VERSION = "1.02"; our $CVSVERSION = '$Revision: 1.3 $'; ################################################## sub nicedate { ################################################## my ($time) = @_; $time = time() unless defined $time; my ($sec,$min,$hour,$mday,$mon, $year,$wday,$yday,$isdst) = localtime($time); return sprintf "%d/%02d/%02d %02d:%02d:%02d", $year+1900, $mon+1, $mday, $hour, $min, $sec; } 1; __END__ =head1 NAME NiceDate -- Print a date in human-readible format =head1 DOWNLOAD _SRC_HERE_ =head1 SYNOPSIS use NiceDate; print NiceDate::nicedate(), "\n"; print NiceDate::nicedate(time() + 1000), "\n"; =head1 DESCRIPTION C implements a function C which converts a unix time value into the following human-readible format: yyyy/mm/dd hh:mm:ss If C is called without parameters, it will use the current time. =head1 LEGALESE Copyright 2002 by Mike Schilli, all rights reserved. This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself. =head1 AUTHOR 2002, Mike Schilli