Reputation: 918
one table of my database in sqlserver have a column with type of int for store dates.
for example fields are: 1105275802 or 1100330268.
I can convert it to datetime in php with this code:
(int)date('U',1100330268);
I want convert this integers to datetime in sqlserver. how can i do?
thanks for any help.
Upvotes: 0
Views: 4290
Reputation: 14233
That might be difficult since MS SQL run's on Windows systems and date('U') is "Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)". I suppose you could probably calculate the DateTime, but it could get messed up if you don't account for the timezone change between GMT and your local timezone.
select DateAdd(second, 1100330268, '1970-01-01')
Upvotes: 2