Unix Epoch to Sql Datetime Query

  • Hi Guys,

    I am getting one file where the datetime is in seconds (bigint) , its in Unix Epoch format , how can we convert this to a readable dateformat in sql server 2008.

    Also , if anyone can throw some light on what Unix epoch, will be helpful.

    Sample examples :

    1345554248

    1345554580

    1345554271

    1345554603

    1345554033

  • Guys,

    Found this site , it has all the answers to my queries and much more.

    http://www.epochconverter.com/

  • Well, since it's number of seconds elaplsed since 1970-01-01...

    SELECT DATEADD(ss, 1345554248, '1970-01-01')

    SELECT DATEADD(ss, 1345554580, '1970-01-01')

    SELECT DATEADD(ss, 1345554271, '1970-01-01')

    SELECT DATEADD(ss, 1345554603, '1970-01-01')

    SELECT DATEADD(ss, 1345554033, '1970-01-01')

    --Vadim R.

Viewing 3 posts - 1 through 2 (of 2 total)

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