Nilofar
Nilofar

Reputation: 31

Time difference need to be added in start time

I hope any one will help me with this. I have two datetime start and end time . I get the time difference between two. eg.

Start Time   18/07/2011 08:49:48
End time     18/07/2011 08:49:52         
Diff         +000000000 00:00:04.000000000 ( 04 seconds)

i need to add this time difference to the start time like this

 18/07/2011 08:49:48 
,18/07/2011 08:49:49
,18/07/2011 08:49:50
,18/07/2011 08:49:51
,18/07/2011 08:49:52

In simple words , Need to add the time difference to the start time one by one. With that i need to do some other calculation.

Thanks in advance.

Upvotes: 3

Views: 102

Answers (1)

Quassnoi
Quassnoi

Reputation: 425673

SELECT  CAST('18/07/2011 08:49:48' AS DATE) + (level - 1) / 86400
FROM    dual
CONNECT BY
        level <= (CAST('18/07/2011 08:49:52' AS DATE) - CAST('18/07/2011 08:49:48' AS DATE)) * 86400 + 1

Upvotes: 4

Related Questions