IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

to find the time stamp difference


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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: 1208
Location: Bangalore,India

PostPosted: Mon Jul 23, 2007 12:43 pm
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts To get the the current time DFSORT/ICETOOL 13
No new posts RC query -Time column CA Products 3
No new posts C Compile time time stamps Java & MQSeries 10
No new posts Parallelization in CICS to reduce res... CICS 4
Search our Forums:

Back to Top