Converting MFC COleDateTime to SQL-datetime

  • Dear All

    Both MFC COleDateTime and SQL-datetime store date internally using a float where the integer part represents the number of days and the decimal part represents the hour:minute:second thing.

    First, the reference day is not the same, 30 december 1899 for MFC and 01 january 1900 for SQL. This is easy to convert.

    The problem is with the decimal part. Does anybody knows a formula to convert between the two representations ? I could first convert to a string but I'd like to know the direct way.

    Thank you

     

    Patrick Duflot

  • It is no FLOAT. It's a BINARY(8) and SQL Server does store two integers in there. The first 4-bytes represent the days since SQL Server's base date, the second 4-bytes stores the clockticks since midnight. Not sure if this helps you, though.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

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

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