Helpful Information
 
 
Category: MS SQL Development
Date and Time Query

Hi,

I have a table who's called call_req. I have a column int called open_date.

The date are stored in unix format like this :

1062748934 = 9 sept 2003

How can I do to do a select command wich return this format: dd/mm/yyyy ?


Thanks

Unix dates start on 1st Jan 1970 (and is seconds since that date), you need to add UNIX date in seconds to the 1970 date, like so:

select convert(varchar(20),DATEADD(SECOND, 1062748934, '1970-01-01 00:00:00.000'),11)

Hope this helps,

Alaistair










privacy (GDPR)