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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it Monday ? 2

Status
Not open for further replies.

redbank

Programmer
Jul 23, 2002
4
GB
I need to determine the day of the week from the current timestamp or any timestamp come to that.

Also the Monday Date of the current week - i.e. if it is Wednesday, what was Monday's date.

I am using IBM's mainframe DB2 tool SPUFI.
 
Select dayname(current timestamp), count(*)
From Table1


That will get you the day of the week. Do you want to get the full date of Monday when it's Wednesday, Thursday, etc?
If so, you could do a case statement like this:

select case when day(current timestamp) = 3 then
Date(current timestamp - 1 days)
case when day(current timestamp) = 4 then
Date(current timestamp - 2 days)
ETC ,

Count(*)
From table1

Hopefully SPUFI lets you do that.


 
Whoops !

I had overlooked that we are on a new release of DB2 which now contains
DAYOFWEEK.

In previous releases this was unavailable.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top