All Forums General
bhaskar3105 4 posts Joined 04/10
28 Jan 2015
TIME STAMP Difference in DAYS

Hi,
We are doing a code migration from a open source database to TD. 
There is a code which subtracts two timestamp field like the one below
SELECT (TIMESTAMP '2012-10-14 23:59:00' - TIMESTAMP '2012-10-14 00:00:00') DAY(4);
For the above the result in TD would be 0 as the start and end datetime is on the same day, however the code in the source database give 1. 
Select (CAST(li.enddatetime AS TIMESTAMP(0)) - CAST(li.Startdatetime AS TIMESTAMP(0))) DAY(4)
Appreciate if someone could help me here
Thanks!
 
From Table X;
 
 
 

bhaskar3105 4 posts Joined 04/10
29 Jan 2015

Got the solution for this!

dnoeth 4628 posts Joined 11/04
31 Jan 2015

Great you got the solution, but could you share it, too?
And could you mention which DBMS returns one day if it's actually less than one?
What does it return for 
SELECT (TIMESTAMP '2012-10-15 00:00:01' - TIMESTAMP '2012-10-14 23:59:59') DAY(4);

Dieter

FishyFly 1 post Joined 02/15
18 Feb 2015

yes please share, it will be a great help

[url= http://www.pyxle.net/web-design-and-development]Web development Sri Lanka[/url]

You must sign in to leave a comment.