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
 

 

day and Time related query

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
chrakesh

New User


Joined: 03 May 2010
Posts: 16
Location: india

PostPosted: Wed May 12, 2010 12:56 pm    Post subject: day and Time related query
Reply with quote

Hi how can i find whether some specific date suppose dome Due_date is between the following Sunday 12 am and next week Saturday 11:59 pm .

can anyone suggest a sql query for this.
Back to top
View user's profile Send private message

Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed May 12, 2010 2:11 pm    Post subject:
Reply with quote

Read this http://www.ibm.com/developerworks/data/library/techarticle/0211yip/0211yip3.html#icomments
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Wed May 12, 2010 9:51 pm    Post subject:
Reply with quote

or this http://www.ibm.com/developerworks/data/library/techarticle/0211yip/0211yip3.html
Back to top
View user's profile Send private message
chrakesh

New User


Joined: 03 May 2010
Posts: 16
Location: india

PostPosted: Tue May 25, 2010 1:46 pm    Post subject:
Reply with quote

Can anyone help me on this query, how can we write the specific query?
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1280
Location: Belgium

PostPosted: Tue May 25, 2010 2:43 pm    Post subject:
Reply with quote

You should be able to figure it out by yourself, by reading the stuff.

a date is not between timestamps,
a specific timestamp is between next sunday, 12am and following saturday,23:59 pm
a specific date is between next sunday and following saturday

Code:
select
current_date + (7 - dayofweek_iso(current_date)) days,
current_date + (13 - dayofweek_iso(current_date)) days,
timestamp(current_date + (7 - dayofweek_iso(current_date)) days,'00:00:00'),
timestamp(current_date + (13 - dayofweek_iso(current_date)) days,'23:59:59')+ 999999 microseconds
from sysibm.sysdummy1
Back to top
View user's profile Send private message
chrakesh

New User


Joined: 03 May 2010
Posts: 16
Location: india

PostPosted: Tue May 25, 2010 5:32 pm    Post subject:
Reply with quote

Thanks man....
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 Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Omegamon for DB2 query ashek15 DB2 0 Wed Feb 15, 2017 11:25 am


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