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
No new posts ISMF Difference between volume count ... upendrasri IBM Tools 2 Tue Dec 05, 2017 12:40 pm
No new posts Comparision with current time arunsoods DFSORT/ICETOOL 5 Thu Nov 09, 2017 10:37 am
This topic is locked: you cannot edit posts or make replies. Comparing current time with the time ... arunsoods SYNCSORT 1 Mon Oct 30, 2017 4:07 pm
No new posts Finding difference between two PS fil... Vignesh Sid SYNCSORT 5 Mon Oct 30, 2017 1:13 pm
This topic is locked: you cannot edit posts or make replies. Incrementing current time field by 30... arunsoods DFSORT/ICETOOL 11 Thu Oct 26, 2017 3:22 pm

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