Epoch time

  • Hi,

     

    I have a table with a field with epoch time value.

    How can I convert it to a Date/Time like dd/mm/yyyy hh:mm:ss ?

     

    Thank you

  • SELECT DATEADD(s,[epochcolumn],'19700101')

    assuming that your 'Date Zero' is 01/01/1970

    Far away is close at hand in the images of elsewhere.
    Anon.

  • Sounds of applause!!!

    Now do you have anything for the required formatting other than concatenation ?!?!

    <pre class="code"

    SELECT convert(varchar, DATEADD(s, epochCol,'19700101'), 103) + ' '

    + convert(varchar, DATEADD(s, epochCol,'19700101'), 108)

    AS formattedDate







    **ASCII stupid question, get a stupid ANSI !!!**

  • Excellent, working fine 🙂

  • quoteNow do you have anything for the required formatting other than concatenation ?!?!

    STUFF(CONVERT(varchar,DATEADD(s, epochCol,'19700101'),120),1,10,CONVERT(char(10),DATEADD(s, epochCol,'19700101'),103))

    Far away is close at hand in the images of elsewhere.
    Anon.

  • An alternative certainly - but not quite the elegant minimalistic solution that I've come to expect from you...

    just goes to show that a pedestal is a very precarious place to be on...never know when you can topple..







    **ASCII stupid question, get a stupid ANSI !!!**

  • quotebut not quite the elegant minimalistic solution...

    Workmen (or should it be workpersons  ) hate to blame their tools but.....

    quotea pedestal is a very precarious place to be....

    Yeah, but your on the pedestal aren't you

    I would soar like an Eagle  to try to reach you but... Turkey's can't fly

    Far away is close at hand in the images of elsewhere.
    Anon.

  • NO NO D.Burrows - YOU are on the pedestal - I put you there (along with several others I'm sure...) - now you just need to make sure you stay put...tools or no tools-







    **ASCII stupid question, get a stupid ANSI !!!**

  • Far away is close at hand in the images of elsewhere.
    Anon.

  • whatever happened to the restrained sangfroid that the Brits are famous for ?! Must be the influence of those people across the channel!!!!







    **ASCII stupid question, get a stupid ANSI !!!**

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic. Login to reply