in reply to Date calculations in Perl for Win32

you can use the builtin localtime, just as on unix:

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

just tested it on my wife's DOS98 box. I know it works on NT.

Replies are listed 'Best First'.
RE: Re: Date calculations in Perl for Win32
by extremely (Priest) on Aug 30, 2000 at 14:13 UTC

    This question deserves real code, specially since I just had to deal with almost the same thing.

    my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdt) = localtime(ti +me); my $weekofyear=0; #first week is first sunday, 0 == lastyear; if ($yday>=$wday) { #into the first week $weekofyear=int(($yday-$wday)/7)+1; #normalize to sunday }

    That should do the trick nicely. Also, look at the Time::Local module. You'd be amazed what you can do once you have it in seconds...

    --
    $you = new YOU;
    honk() if $you->love(perl)