Last active
February 10, 2021 14:58
-
-
Save pierslawson/6493e5d8aa2897808191c22dd491d42d to your computer and use it in GitHub Desktop.
Trying out date accuracy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Globalization; | |
using System.Data.SqlTypes; | |
public class Program | |
{ | |
public static void Main() | |
{ | |
Console.WriteLine("2016,11, 13,7,11,58,837.0"); | |
SqlDateTime dateToTestSql = new SqlDateTime(2016,11, 13,7,11,58,837.0); | |
Console.WriteLine(dateToTestSql.ToString()); | |
Console.WriteLine(dateToTestSql.Value.Millisecond.ToString()); | |
DateTime dateToTest = (DateTime)dateToTestSql; | |
Console.WriteLine(dateToTest.ToString("O")); | |
Console.WriteLine(""); | |
Console.WriteLine("2016,11, 13,7,11,58,836.0"); | |
dateToTestSql = new SqlDateTime(2016,11, 13,7,11,58,836.0); | |
Console.WriteLine(dateToTestSql.ToString()); | |
Console.WriteLine(dateToTestSql.Value.Millisecond.ToString()); | |
dateToTest = (DateTime)dateToTestSql; | |
Console.WriteLine(dateToTest.ToString("O")); | |
Console.WriteLine(""); | |
Console.WriteLine("2016,11, 13,7,11,58,834.0"); | |
dateToTestSql = new SqlDateTime(2016,11, 13,7,11,58,834.0); | |
Console.WriteLine(dateToTestSql.ToString()); | |
Console.WriteLine(dateToTestSql.Value.Millisecond.ToString()); | |
dateToTest = (DateTime)dateToTestSql; | |
Console.WriteLine(dateToTest.ToString("O")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment