IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

how to get WEEK from a given timestamp.


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Haripriya3103

New User


Joined: 29 Jun 2005
Posts: 3

PostPosted: Tue Aug 16, 2005 3:55 pm
Reply with quote

I have a timestamp stored in a working storage variable, I need the nth Week for the given timestamp.
Back to top
View user's profile Send private message
withnams

New User


Joined: 06 Jul 2005
Posts: 26
Location: Chennai

PostPosted: Tue Aug 16, 2005 8:49 pm
Reply with quote

WEEK
Returns a value in the range 1 to 53 or 54 that represents the week of the year, where a week
begins on a Sunday, or on the first day of the year. Valid input types are a date, a timestamp,
or an equivalent character value. The output is of type integer.
SELECT WEEK(DATE('2000-01-01')) AS W1 ANSWER
,WEEK(DATE('2000-01-02')) AS W2 ==================
,WEEK(DATE('2001-01-02')) AS W3 W1 W2 W3 W4 W5
,WEEK(DATE('2000-12-31')) AS W4 -- -- -- -- --
,WEEK(DATE('2040-12-31')) AS W5 1 2 1 54 53
FROM SYSIBM.SYSDUMMY1;
Figure 318, WEEK function examples
Both the first and last week of the year may be partial weeks. Likewise, from one year to the
next, a particular day will often be in a different week.

Got this from IBM manuals
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Insert system time/date (timestamp) u... DFSORT/ICETOOL 5
No new posts Timestamp difference and its average ... DB2 11
No new posts To get previous month from current ti... SYNCSORT 7
No new posts Calculate with timestamp PL/I & Assembler 19
Search our Forums:

Back to Top