Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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
This topic is locked: you cannot edit posts or make replies. 00D3003B - time outs in DB2 when invo... chavinash2004 DB2 2 Mon Oct 09, 2017 4:39 pm
No new posts VSAM RLS Wait time blayek JCL & VSAM 2 Mon Oct 02, 2017 9:05 pm
No new posts Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts Regarding time parameter shanthi gude JCL & VSAM 7 Mon Sep 04, 2017 2:31 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us