in reply to Date conversion
Comment: It does not print values less than 10 with a leading zero. If you need that, it can be easily added. It is left as an exercise for the reader.($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time +); $year += 1900; $mon += 1; print join '_', ($year,$mon,$mday,$hour,$min,$sec); # YYYY_MM_DD_HH_M +M_SS
Update: Added $mon += 1. Thanks graff
CountZero
"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Date conversion
by graff (Chancellor) on Mar 25, 2004 at 02:11 UTC | |
|
Re: Re: Date conversion
by halley (Prior) on Mar 25, 2004 at 15:04 UTC | |
by CountZero (Bishop) on Mar 25, 2004 at 19:29 UTC |