Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 888
Nilofar Avatar asked Jan 18 '26 20:01

Nilofar


1 Answers

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
like image 131
Quassnoi Avatar answered Jan 21 '26 10:01

Quassnoi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!