Date conversion problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bedlam
    New Member
    • Apr 2010
    • 2

    Date conversion problem

    I have a date stored in an INT column of 2440588
    This is supposed to be the date of 01/01/1970.
    I can not find any way to convert the 2440588 value to a MM/DD/YYYY format, no matter what I try. Maybe I need another set of eyes.
    Anyone able to help?

    Thanks
    TK
  • code green
    Recognized Expert Top Contributor
    • Mar 2007
    • 1726

    #2
    I think you mean this is a Unix timestamp,
    and the value is the number of seconds since 1/1/1970.
    There is no direct SQL function to do this, but the standard way is to use DATEDIFF() or DATEADD()
    Code:
    SELECT DATEADD(SS,2440588,'01/01/1970')
    Gives 1970-01-29 with a time

    Comment

    • bedlam
      New Member
      • Apr 2010
      • 2

      #3
      Figured it out. The stored integer 2440588 does represent the date 01/01/1970, if you use the Julian date (JDN actually) for the number of days since Jan 1, 4713 BC...yep...BC.

      Thanks for the reply.

      Comment

      Working...