Float column used as a date. Contains negative number

  • I have a third party table with a column DateOfBirth. An example of the columns contents are:

    -1310389200000

    -1792155600000

    983620800000

    I've tried many different methods to convert this into a meaningful date.

    Any insight would be appreciated.

    Thanks

  • That's hashed, encrypted, or proprietary... and rather wild. FLOAT?!

    Any chance you can share the name of the software?


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • Better not share the name of the software. I've been searching and maybe it's stored as some type of windows file time?

  • This is what I have so far:

    declare @floatdatetime as float

    set @floatdatetime = -1310389200000

    select DATEADD(ms,

    ((cast(@floatdatetime as bigint)) / CAST(10000 AS bigint)) % 86400000,

    DATEADD(day, (cast (@floatdatetime as bigint)) / CAST(864000000000 AS bigint) - 109207, 0))

    Alas, this produces a "Adding a value to a 'datetime' column caused overflow" error.

  • They look to me like UNIX timestamps ('epochtime'). Thery even make sense for negative number for people born befor January 1, 1970. For example, the last number divided by 1,000 (to get rid of milliseconds) translates to 2/12/1973.

  • Thanks for your help. You identifying the type of data I'm dealing with put me on the right track to finding the solution.

    Here's what works for me:

    SELECT DATEADD(s,(-1310389200000/1000),'19700101')

Viewing 6 posts - 1 through 5 (of 5 total)

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