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
 

 

to find the time stamp difference

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

New User


Joined: 16 Jan 2007
Posts: 9
Location: Bangalore

PostPosted: Mon Jul 23, 2007 11:55 am    Post subject: to find the time stamp difference
Reply with quote

Hi,
I need to get the difference between two time stamps using SQL Query.Can anyone explain me how I can write that SQL query ?

this is urgent.

Thanks n regards,
Sree...
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Mon Jul 23, 2007 12:43 pm    Post subject:
Reply with quote

Hi Sree,

First of all please read forum rules.
We are not here to do ur homework so please do not specify urgent & all
Well Please find below query

Code:
SELECT  TIMESTAMP('2007-07-23-08.09.07.821084') - TIMESTAMP('2007-07-23-08.08.07.821084')

FROM SYSIBM.SYSDUMMY1;
U can also move timestamp in to some hostvariable & use the query to identify the difference.
Back to top
View user's profile Send private message
sandeep1dimri

New User


Joined: 30 Oct 2006
Posts: 76

PostPosted: Mon Jul 23, 2007 12:51 pm    Post subject:
Reply with quote

Hi

Similary if one need to get difference between dates,hour, sec or microosec form time stamp can be achieived from Db2 standard functions.

for example to get various values from time stamp.

SELECT CURRENT TIMESTAMP,
YEAR (CURRENT TIMESTAMP),
MONTH (CURRENT TIMESTAMP),
DAY (CURRENT TIMESTAMP),
HOUR (CURRENT TIMESTAMP),
MINUTE (CURRENT TIMESTAMP),
SECOND (CURRENT TIMESTAMP),
MICROSECOND (CURRENT TIMESTAMP)
FROM SYSIBM.SYSDUMMY1;

So respective diff can be done on any of above values.

Hope it will help.

sandeep
Back to top
View user's profile Send private message
sreelekshmi

New User


Joined: 16 Jan 2007
Posts: 9
Location: Bangalore

PostPosted: Mon Jul 23, 2007 12:59 pm    Post subject:
Reply with quote

I am really sorry,Only I meant is to get a quick help if possible.

Thanks for the reply
Sree..
guptae wrote:
Hi Sree,

First of all please read forum rules.
We are not here to do ur homework so please do not specify urgent & all
Well Please find below query

Code:
SELECT  TIMESTAMP('2007-07-23-08.09.07.821084') - TIMESTAMP('2007-07-23-08.08.07.821084')

FROM SYSIBM.SYSDUMMY1;
U can also move timestamp in to some hostvariable & use the query to identify the difference.
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 find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts DSNACCOX (can it be run on 1 db/ts, t... SRICOBSAS DB2 3 Sat May 06, 2017 12:59 am
No new posts To find out size allocated to a seque... ashek15 JCL & VSAM 15 Thu Apr 27, 2017 9:42 am
No new posts LISTIDR compiled date/time jerryte IBM Tools 3 Thu Apr 20, 2017 7:37 pm
No new posts Application not run by time HH:MM tri... jzhardy IBM Tools 1 Sun Apr 09, 2017 3:22 pm


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