On Wed, 5 Dec 2001 15:46:26 -0800, [EMAIL PROTECTED] wrote:

>I'm at a bit of a loss.  I need to be able to determine what day of the
>week a given date is (that is, December 5, 2001 is day 4 or some such).  I
>would think this is trivial, but can't seem to find the technique for doing
>it.  Any suggestions would be appreciated.

One of the fields in localtime() in list context has it. So has
gmtime(). It's... (peeking at the docs for "localtime"...) number 6.

        print +(localtime)[6]

That prints a 4, but it's already past midnight. FYI sunday is day zero.

That is for today. If you want it for any date, the standard module
Time::Local, with functions timelocal() and timegm(), the inverse of
localtime() and gmtime(), can be used to turn a date back into the
seconds-since-the-epoch number that you need to apply the above function
to.

-- 
        Bart.

Reply via email to