#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    1
    Rep Power
    0

    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
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    5
    Rep Power
    0
    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

IMN logo majestic logo threadwatch logo seochat tools logo