Is there a way to convert the format "datetime" to "timestamp" in Sql Server CE?

I know there is a way to do this on a regular Sql server, and if I'm not mistaken, it looks something like this:

SELECT UNIX_TIMESTAMP(ba_trans_entered) * 1000 AS 'dateUTC'

However, I acknowledge that I do not receive the part * 1000, but not the specified point.

When I try to execute this query in SQL Server CE, it just tells me (i.e. WebMatrix tells me):

'UNIX_TIMESTAMP' is not a recognized built-in function name.

I assume it is UNIX_TIMESTAMPnot supported in Sql Server Compact.

In addition, I tried to do a Google search and search here in SE, but the data related to SQL Server CE is not displayed, so this may not be the case in this environment.

Is there a way to convert 'datetime' (example:) 7/13/2007 12:00:00 AMto timestamp (example:) 1184302800000? I know that I can do this in JavaScript, but they told me that it can do it faster in the request itself, and since I pull a ton of data ...

+3
source share
1 answer

The UNIX_TIMESTAMP function does not exist in SQL Server on SQL Server Compact, but you can use DATEDIFF:

DATEDIFF(SECOND,{d '1970-01-01'}, ba_trans_entered)
+5
source

All Articles