Cast as datetime from Unix Time Code in SQL Server

I have a field called ExWorksDate which is UnixDate/Time code.

I am needing to join it to field in SQL Server that is datetime field. I am currently casting it as a date

CAST(dateadd(S, [ExWorksDate], '1970-01-01') as date) as [ExWorksDate]

I need to convert it to the format 2000-01-04 00:00:00.000 which is in the date table. So basically wipe the seconds of it.. but cast it as date/time.

Any help appreciated

Read more here:

Content Attribution

This content was originally published by Christopher Jack at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: