Created
November 23, 2011 11:25
-
-
Save kell05/1388468 to your computer and use it in GitHub Desktop.
Returns the current date in yyyymmdd format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub current_date{ | |
my ($d,$m,$y) = (localtime)[3,4,5]; | |
# Normalise dates | |
($m+=1,$y+=1900); | |
# Check prefix with zero | |
$m = "0$m" if ($m < 10); | |
$d = "0$d" if ($d < 10); | |
return "$y$m$d"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment