Re: Date function



In article <4t3t5hF126g8tU1@xxxxxxxxxxxxxxxxxx>,
Gunnar Hjalmarsson <noreply@xxxxxxxxx> wrote:

boyd wrote:
In article <4t3qsqF11g6o6U2@xxxxxxxxxxxxxxxxxx>,
Gunnar Hjalmarsson <noreply@xxxxxxxxx> wrote:
boyd wrote:
something like:

my( $day, $mon, $yr ) = ( localtime( time - 24*3600) )[3, 4, 5];
$yr += 1900;
$mon += 1;
my $str = sprintf '%4d-%02d-%02d', $yr, $mon, $day;

would give you the prefix string for your filename.

What about DST? ;-)

Good point. So my method would mess up on one of the DST changeovers if
it ran between midnight and 0100 local. Is that right?

Yeah, that's what I'm thinking of. Maybe not a disaster in this case,
but always worth considering when dealing with dates.

What is the "40000" for in your script?

That's 'approximately' 12 hours, i.e. well enough time to make the
result DST safe. :)

Thanks. I have another question. I administer a Sun network and one
Linux box at work, both of which are isolated from the world ( I have to
hand carry in patches, etc. ) So the upcoming DST rule change may be a
problem. I'm sure you are aware that next March, DST starts on, IIRC,
Mar. 11, and ends the first weekend in November. What's the best way to
deal with the changes? (at home I have Ubuntu and Mac OS X )

Boyd
.