[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: day of the week



If you can get the Julian date of the special date, you can use the
following formula:

        LET #DOW = ( ( #Julian_Date + 1 ) % 7 ) + 1

This will give you a value of 1 to 7 (Sunday to Saturday), like today is
Julian date 2451109, so if wee plug that in:

        #DOW = ( ( 2451109 + 1 ) % 7 ) + 1
           = ( 2451110 % 7 ) + 1
           = 4 + 1
           = 5

As for the week of the year, you will need to determine what day of the year
it is from (1 to 365/366) and divide by 7.

For a bunch of database independent date functions, there is a library that
I wrote a couple of years ago posted on the SQRUG home page called
DATEFUNC.SQC (http://www.sqrug.com/ftp/datefunc.sqc), it has all of these
formulas in it

......Rob
_________________________________________________
Robert Goshko <mailto:robert.goshko@axis-dev.com>
Owner
Axis Developments
System Consulting Services
Sherwood Park, Alberta, Canada
http://www.axis-dev.com/


-----Original Message-----
From: Discussion of SQR, SQRIBE Technologies's database reporting
language [mailto:SQR-USERS@list.iex.net]On Behalf Of Karin Öberg
Sent: Thursday, October 22, 1998 7:40 AM
To: Multiple recipients of list SQR-USERS
Subject: day of the week


I´ve bumped into a little problem with an SQR-report,
and would really appreciate som help.

Does anyone know how to get the number of week
and the day of week from a special date??

> //Karin