Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

(Dermot) Re: Converting date to dd/mm/yyyy from year/day of year

by Dermot (Scribe)
on Sep 27, 2000 at 20:01 UTC ( [id://34228]=note: print w/replies, xml ) Need Help??


in reply to Converting date to dd/mm/yyyy from year/day of year

Someone offline suggested this to me. Ok, fair enough you don't reinvent the wheel unless you have too or for educational purposes but leaving that aside for the moment is messing with dates one of those things like parsing HTML that you're just better off not trying to do from scratch ?
#!/usr/bin/perl -w use strict; use Time::Local qw( timelocal ); my $year = 2001; my $day = 200; my $year_sec = timelocal(0, 0, 0, 1, 0, $year-1900); my $new_sec = $year_sec + ($day-1) * 60 * 60 *24; print localtime($new_sec)."\n"; my ($theday, $month) = (localtime($new_sec))[3,4]; $month++; print "day = $theday, month = $month\n";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://34228]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-04-24 15:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found