<!-- SophiaKnows -->

PERL DATESTRINGS
Rev 2: December 2004

#!/usr/local/bin/perl

@shortmons = ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
@shortdays = ("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
@monthlengths=("31", "28", "31", "30", "31", "30", "31", "31", "30", "31", "30", "31");

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdt) = localtime(time);
$year += 1900;

# DATESTRING: US TEXTDATE
$textdate = "$shortdays[$wday], $shortmons[$mon] $mday, $year";

# DATESTRING: US DIGITDATE
$usdate = Return2Digits($mon+1)."/".Return2Digits($mday)."/".$year;

# DATESTRING: DATESTAMP
$stampdate = $year.".".Return2Digits($mon+1).".".Return2Digits($mday);

# APPEND LEADING ZERO
sub Return2Digits {
   return (($_[0]<10)?"0"."$_[0]":$_[0]);
   }

1;

< CODEBASE | TOP^ | MAINPAGE >

Text & Design By Tony Pisarra
© SophiaKnows 1998-2004