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!

are these date functions supported ?

Status
Not open for further replies.

Lesio

MIS
Jan 7, 2003
48
US
Are any of these date functions supported in DB2 ?

Monday of the week (INPUT: date)
for example Monday of the week (2005/02/01) = 2005/01/31

1st of the month (INPUT: date)
for example 1st of the month (2005/01/21) = 2005/01/01

1st of the year (INPUT: date)
for example 1st of the year (2005/04/21) = 2005/01/01

Thanks !
 
These are all easily calculated in DB2 by using DAYOFWEEK , DAYOFYEAR or DAY of a date and adjusting the actual date with sinple arithmemetic:

1st of year = Date - dayofyear(date) days + 1

Look at the SQL cookbook for details of the options available

The pdf Cookbook is found with a search on 'Graeme Birchall'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top