in reply to Getting Day Of Month

Convert 05/25/2002 to epoch date, use localtime.

Replies are listed 'Best First'.
Re: Re: Getting Day Of Month
by PsychoSpunk (Hermit) on Jan 03, 2001 at 00:48 UTC
    Or use Date::Format; and say time2str("%A",$time);

    You did want Saturday, right?

    Update: I got ahead of myself. time2str uses a epoch time which you could get from timelocal. Turns out, I should have used
    strftime("%A", ['','','',25,05,2002]);

    ALL HAIL BRAK!!!

Re: Re: Getting Day Of Month
by mt2k (Hermit) on Jan 03, 2001 at 00:50 UTC
    Um, what do I do for that localtime() part??
    Or Psycho, what does $time hold?

    Could you give me the code, I'm slow.

    Update: Hey, isn't the Date module standard??
    I have to install the stupid thing... Unbelievable!

      While I strongly suggest taking cat2014's advice... The localtime function converts an Epoch date into a list. If you look at the documentation, it has (IIRC) nine elements, of which one is the number of the day of the week ($wday). Which you can then use to extract the day of the week from your own @days = ( Sun, Mon, Tue, Wed, Thu, Fri, Sat) list, using $days[$wday]. Update: Getting your input date into Epoch time without a module like Date::Manip, however, is tricky as all heck and not recommended.