Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PH QUIZ

Status
Not open for further replies.

Shedboy

IS-IT--Management
Apr 22, 2002
7
GB
Does anyone out there know if there is a QUIZ function for getting the name of the day from the date?

i.e. I have the date in normal format, 02/08/03, I need it to return SATURDAY.

There is a SQL function (TO_CHAR(T1."DATE" ,'DAY') and a Cognos Impromptu function (dayname(date)) but I can't find anything for QUIZ.

Any help appreciated.

SB
 
You can display the date as a day of the week in Impromptu by changing the data format to 'dddd'. Is that what you wanted?
Simon Rouse
 
SB,

Sorry. There is little traffic here on the non-reporting tools from Cognos. Someone might have an idea here, but I've not seen much for PowerHouse, Axiom, or Quiz.

Dave Griffin


The Decision Support Group
Reporting Consulting with Cognos BI Tools
"Magic with Data"
[pc2]
Want good answers? Read FAQ401-2487 first!
 
This is a way to extract the day of the week from a date:

use the DAYS function to return the quantity of days from a date, where the base
date for the DAYS function is Sunday December 31, 1899 (18991231)

When you run DAYS on youre date it will give you the number of days since this date.
For example DAYS(20030807) = 37839 days

Simply do a modolus 7 of the number of days and you will have the day of the week:

Monday = 1
Tuesday = 2
Wedensday 3
Thursday = 4
Friday = 5
Saturday = 6
Sunday = 7

The code should look something like this:

DEFINE DAYOFWEEK NUM*5 = MOD(DAYS(20030807),7)

The result should be: 4 which is Thursday

AtleOlsen ;-)
 
Thanks AtleOlsen,

That looks like it should work.......

SB
 
It has been a while since I used quiz, but if my memory serves me correctly you first need to convert the date using the days function. Use the result of this function as input to the mod function.

define d-days = days(your-date)
define d-mod = mod(d-days,7)

I can't remember the datatypes, integer possibly?

the resulting contents of d-mod indicate a certain day

0 - sunday
1 - monday
2 - tuesday
.
.
.
7 - saturday.

Like I say, it has been a long time, but the answer is along these lines.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top