Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

how to get WEEK from a given timestamp.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: how to get WEEK from a given timestamp.
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to find the first monday of the w... abdulrafi COBOL Programming 10 Fri Nov 25, 2016 3:24 pm
No new posts Converting EBCDIC to Unicode (TimeStamp) muralikrishnan_new COBOL Programming 2 Mon Jul 25, 2016 10:42 pm
No new posts Convert Timestamp Value mrdinesh DFSORT/ICETOOL 7 Thu May 05, 2016 6:01 pm
No new posts Comparing timestamp in Synscort l.nethaji SYNCSORT 13 Wed Jan 20, 2016 4:47 pm
No new posts pass numeric value of length 14 to ti... Ralph Zbrog Java & MQSeries 4 Fri Jan 15, 2016 3:20 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us