Hey All, 

I will close this post.  Ended tweaking my application so instead of using a webservice to initially get the time and date in epoch, I used select now().  So my application now works as per below, it automatically deals with DST and epoch conversion to the required datetime format.

var1 = select now()

select COUNT ("Arrival Time") FROM dbo.table where "Arrival Time" < var1

oh yeah getting closer.  It looks like the webservice I am using is actually sending me UTC Time and I need to convert to my timezone

select DATEADD(ms, CONVERT(string,LEFT(1603274296000+39600000, 20)), '1970-01-01 00:00:00')

adds 11 hours and shows my current time of 2020-10-21 20:58:16

Hey Julius, 

I intended to write 

select COUNT ("Arrival Time") FROM dbo.table where "Arrival Time" < DATEADD(ms, CONVERT(int,LEFT(1603173432000, 20)), '1970-01-01 00:00:00')

However it is returning a count of 0.  1603173432000 being 2020-10-21 13:00:00 so there should be a COUNT of 2

Arrival Time
2020-10-21 12:50:05
2020-10-21 12:57:56
2020-10-21 13:42:11

It is just testing ATM but I dont epect the table to be more than 100 rows as old records get deleted.

Daniel has no followers yet.
Daniel has not followed anybody yet.
Global Masters badges:
Daniel has no Global Masters badges yet.