Index: System.Data.SQLite/SQLiteConvert.cs ================================================================== --- System.Data.SQLite/SQLiteConvert.cs +++ System.Data.SQLite/SQLiteConvert.cs @@ -260,11 +260,11 @@ /// culture-independent formatted date and time string, a formatted date and time string in the current /// culture, or an ISO8601-format string. /// The SQLiteDateFormats to use. /// The DateTimeKind to use. /// A DateTime value - public DateTime ToDateTime(string dateText, SQLiteDateFormats format, DateTimeKind kind) + public static DateTime ToDateTime(string dateText, SQLiteDateFormats format, DateTimeKind kind) { switch (format) { case SQLiteDateFormats.Ticks: { @@ -327,11 +327,11 @@ /// Converts a julianday value into a DateTime /// /// The value to convert /// The DateTimeKind to use. /// A .NET DateTime - public DateTime ToDateTime(double julianDay, DateTimeKind kind) + public static DateTime ToDateTime(double julianDay, DateTimeKind kind) { return DateTime.SpecifyKind( DateTime.FromOADate(julianDay - OleAutomationEpochAsJulianDay), kind); } @@ -338,11 +338,11 @@ /// /// Converts a DateTime struct to a JulianDay double /// /// The DateTime to convert /// The JulianDay value the Datetime represents - public double ToJulianDay(DateTime value) + public static double ToJulianDay(DateTime value) { return value.ToOADate() + OleAutomationEpochAsJulianDay; } /// Index: Tests/basic.eagle ================================================================== --- Tests/basic.eagle +++ Tests/basic.eagle @@ -999,10 +999,28 @@ \{4096, Page Size=4096\} 0 \{1024, Max Page Count=1024\} 0 \{8192, Cache\ Size=8192\} 0 \{UnixEpoch, DateTimeFormat=UnixEpoch\} 0 \{Utc,\ DateTimeKind=Utc\} 0 \{sqlite_schema, BaseSchemaName=sqlite_schema\} 0\ \{Memory, Journal Mode=Memory\} 0 \{Serializable, Default\ IsolationLevel=Serializable\} 0 \{False, Foreign Keys=False\}$}} + +############################################################################### + +runTest {test data-1.17 {SQLiteConvert ToDateTime (Julian Day)} -body { + set dateTime [object invoke System.Data.SQLite.SQLiteConvert ToDateTime \ + 2455928.0 Utc] + + object invoke $dateTime ToString [getDateTimeFormat] +} -cleanup { + unset -nocomplain dateTime +} -constraints {eagle System.Data.SQLite} -result {2012-01-01 12:00:00Z}} + +############################################################################### + +runTest {test data-1.18 {SQLiteConvert ToJulianDay} -body { + expr {round([object invoke System.Data.SQLite.SQLiteConvert ToJulianDay \ + "2012-01-01 12:00:00Z"])} +} -constraints {eagle System.Data.SQLite} -result {2455928}} ############################################################################### unset -nocomplain testExeFile testLinqExeFile northwindEfDbFile testLinqOutFile