ignore that post earlier, i found the answer, after some diving in google

@months = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul',
   'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
$monthname = $months[(localtime(time))[4]];

works like a charm 

//Dave

-----Original Message-----
From: David Samuelsson (PAC) [mailto:[EMAIL PROTECTED]]
Sent: den 27 mars 2002 10:16
To: '[EMAIL PROTECTED]'
Subject: get $month?


this is probably a question that has been asked a lot, but this is a beginner mailing 
list =)

my @date = localtime;
$date = sprintf("%02d-%02d-%02d", $date[3], $date[4]+1,($date[5]+1900)%100);
print $date, "\n";

this prints today: 27-03-02

how do i "convert" so it prints 03 as this month instead ie: mar, and for 04 apr and 
so on.

i probably need to add an array with fixed months i guess like: @months = 
('jan','feb','mar','apr',may','jun','jul','aug','sep','oct','nov','dec');

how do i get this in this code, or anyone have a better idea?

btw thanks for the help with the regex that extracted date Kevin Cornmell, your regexp 
worked right away =)

//Dave

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  • get $month? David Samuelsson (PAC)
    • David Samuelsson (PAC)

Reply via email to