# This gives you the web standard date format # Sat, 08 Feb 2003 15:13:54 GMT use POSIX; my $date = POSIX::strftime("%a, %d %b %Y %H:%M:%S GMT", gmtime(time()) ); print $date, "\n"; # this will give you dd/mm/yyyy hh:mm:ss for GMT # note $mday is actual day, $mon 0 = jan, 1=feb, 11=dec # year is currently 103 ie you need to add 1900 for yyyy # or subtract 100 and pack with a left zero for yy my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time); printf "%02d/%02d/%04d %02d:%02d:%02d\n", $mday, $mon+1, $year+1900, $hour, $min, $sec; # or for localtime my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); printf "%02d/%02d/%04d %02d:%02d:%02d\n", $mday, $mon+1, $year+1900, $hour, $min, $sec; # this will give you dd/mm/yy for GMT my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time); printf "%02d/%02d/%02d\n", $mday, $mon+1, $year-100; # etc # perl will preformat datestrings if you call localtime() or gmtime() in # scalar as opposed to arrray context. you can see this here # time() is the default value as you can also see my @bits = localtime; my $str = localtime; print " array context: @bits scalar context: $str"; __DATA__ Sat, 08 Feb 2003 15:28:14 GMT 08/02/2003 15:28:14 08/02/2003 15:28:14 08/02/03 array context: 14 28 15 8 1 103 6 38 0 scalar context: Sat Feb 8 15:28:14 2003