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 alotWhy 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));
精彩评论