开发者

sql server and long date time

HI:

I need to convert a bigint filed in databa开发者_StackOverflowse to equivalent datatime

i couldn't do this from sqlserver nor visual studio

i have tried ticks but its not useful any idea? thanks alot


Why not just like in SQL Server: get minutes and add them to (dateTime.AddMinutes) to 1900-01-01 ?

Convert .NET Ticks to SQL Server DateTime

(we know that at 1900-01-01 ticks count was 599266080000000000)

        long tNow = 634024345696365272;
        long t1900 = 599266080000000000;

        double minutes = (tNow - t1900) * Math.Pow((double)10,-7) / 60;
        var dataTime = DateTime.Parse("1900-01-01").AddMinutes(Math.Round(minutes));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜