difference in timestamps..

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
kollurianu
Premium Member
Premium Member
Posts: 614
Joined: Fri Feb 06, 2004 3:59 pm

difference in timestamps..

Post by kollurianu »

Hi All,

How do I get difference two timestamps ?
I want to know if two timestamps are within a minute , how do acheive this?

Lets us say time1 is 15:41

time2 is 20:40

without doing substrings..is there a way to use functions.




Advance Thanks to you all.
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

SecondsSinceFromTimestamp()
You are the creator of your destiny - Swami Vivekananda
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Format both the input to the meet the SecondsSinceFromTimestamp() standards and subtract.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
kollurianu
Premium Member
Premium Member
Posts: 614
Joined: Fri Feb 06, 2004 3:59 pm

Post by kollurianu »

Thank you all for your responses.

But my input times are from file (ie; is varchar) and as below

Time 1 is 8/4/2010 12:40

Time 2 is 8/4/2010 12:41

I see many functions are available but
could someone please suggest me with some data/time functions with exact format as help is not very clear for me.



Thanks for your help.
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Add zero to month and day if your input dont have

Code: Select all

SecondsSinceFromTimestamp(TimeStampToString(StringToTimeStamp('08/04/2010 12:41':':00','%dd/%mm/%yyyy %hh:%nn:%ss'),'%yyyy-%mm-%dd %hh:%nn:%ss'),TimeStampToString(StringToTimeStamp('08/04/2010 12:40':':00','%dd/%mm/%yyyy %hh:%nn:%ss'),'%yyyy-%mm-%dd %hh:%nn:%ss'))
You are the creator of your destiny - Swami Vivekananda
Post Reply