I use this for creating very readable and sortable unique directory names for our code builds. I prepend the build information to the date string returned above. An example would be: BETA_13__10_05_05_10000sub makeDate { (my $sec, my $min, my $hour, my $mday, my $mon, my $year, my $wday +, my $yday, my $isdst) = localtime(time); $year += 1900; $sec =~ s/^(\d)$/0$1/; $min =~ s/^(\d)$/0$1/; $hour =~ s/^(\d)$/0$1/; $mon++; $mon =~ s/^(\d)$/0$1/; $mday =~ s/^(\d)$/0$1/; my $date = "$mon\_$mday\_$year\_$hour$min$sec"; return $date; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: munging the date for various uses
by Tanktalus (Canon) on Oct 05, 2005 at 19:21 UTC | |
|
Re: munging the date for various uses
by chanio (Priest) on Oct 06, 2005 at 04:34 UTC | |
|
Re: munging the date for various uses
by water (Deacon) on Oct 08, 2005 at 04:46 UTC | |
by montanaperl (Novice) on Oct 10, 2005 at 16:39 UTC | |
|
Re: munging the date for various uses
by grinder (Bishop) on Oct 06, 2005 at 19:02 UTC |