static SQLiteConvert() { SQLiteConvert.FallbackDefaultTypeName = string.Empty; SQLiteConvert.UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); SQLiteConvert.OleAutomationEpochAsJulianDay = 2415018.5; SQLiteConvert.MinimumJd = SQLiteConvert.computeJD(DateTime.MinValue); SQLiteConvert.MaximumJd = SQLiteConvert.computeJD(DateTime.MaxValue); string[] strArrays = new string[] { "THHmmssK", "THHmmK", "HH:mm:ss.FFFFFFFK", "HH:mm:ssK", "HH:mmK", "yyyy-MM-dd HH:mm:ss.FFFFFFFK", "yyyy-MM-dd HH:mm:ssK", "yyyy-MM-dd HH:mmK", "yyyy-MM-ddTHH:mm:ss.FFFFFFFK", "yyyy-MM-ddTHH:mmK", "yyyy-MM-ddTHH:mm:ssK", "yyyyMMddHHmmssK", "yyyyMMddHHmmK", "yyyyMMddTHHmmssFFFFFFFK", "THHmmss", "THHmm", "HH:mm:ss.FFFFFFF", "HH:mm:ss", "HH:mm", "yyyy-MM-dd HH:mm:ss.FFFFFFF", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM-ddTHH:mm:ss.FFFFFFF", "yyyy-MM-ddTHH:mm", "yyyy-MM-ddTHH:mm:ss", "yyyyMMddHHmmss", "yyyyMMddHHmm", "yyyyMMddTHHmmssFFFFFFF", "yyyy-MM-dd", "yyyyMMdd", "yy-MM-dd" }; SQLiteConvert._datetimeFormats = strArrays; SQLiteConvert._datetimeFormatUtc = SQLiteConvert._datetimeFormats[5]; SQLiteConvert._datetimeFormatLocal = SQLiteConvert._datetimeFormats[19]; SQLiteConvert._utf8 = new UTF8Encoding(); Type[] typeArray = new Type[] { typeof(object), typeof(long), typeof(double), typeof(string), typeof(byte[]), typeof(object), typeof(DateTime), typeof(object) }; SQLiteConvert._affinitytotype = typeArray; DbType[] dbTypeArray = new DbType[] { DbType.Object, DbType.Binary, DbType.Object, DbType.Boolean, DbType.SByte, DbType.SByte, DbType.Byte, DbType.Int16, DbType.UInt16, DbType.Int32, DbType.UInt32, DbType.Int64, DbType.UInt64, DbType.Single, DbType.Double, DbType.Decimal, DbType.DateTime, DbType.Object, DbType.String }; SQLiteConvert._typetodbtype = dbTypeArray; SQLiteConvert._dbtypetocolumnsize = new int[] { 2147483647, 2147483647, 1, 1, 8, 8, 8, 8, 8, 16, 2, 4, 8, 2147483647, 1, 4, 2147483647, 8, 2, 4, 8, 8, 2147483647, 2147483647, 2147483647, 2147483647 }; object[] value = new object[] { DBNull.Value, DBNull.Value, 3, DBNull.Value, 19, DBNull.Value, DBNull.Value, 53, 53, DBNull.Value, 5, 10, 19, DBNull.Value, 3, 24, DBNull.Value, DBNull.Value, 5, 10, 19, 53, DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value }; SQLiteConvert._dbtypetonumericprecision = value; object[] objArray = new object[] { DBNull.Value, DBNull.Value, 0, DBNull.Value, 4, DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value, 0, 0, 0, DBNull.Value, 0, DBNull.Value, DBNull.Value, DBNull.Value, 0, 0, 0, 0, DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value }; SQLiteConvert._dbtypetonumericscale = objArray; Type[] typeArray1 = new Type[] { typeof(string), typeof(byte[]), typeof(byte), typeof(bool), typeof(decimal), typeof(DateTime), typeof(DateTime), typeof(decimal), typeof(double), typeof(Guid), typeof(short), typeof(int), typeof(long), typeof(object), typeof(sbyte), typeof(float), typeof(string), typeof(DateTime), typeof(ushort), typeof(uint), typeof(ulong), typeof(double), typeof(string), typeof(string), typeof(string), typeof(string) }; SQLiteConvert._dbtypeToType = typeArray1; TypeAffinity[] typeAffinityArray = new TypeAffinity[] { TypeAffinity.Null, TypeAffinity.Blob, TypeAffinity.Null, TypeAffinity.Int64, TypeAffinity.Int64, TypeAffinity.Int64, TypeAffinity.Int64, TypeAffinity.Int64, TypeAffinity.Int64, TypeAffinity.Int64, TypeAffinity.Int64, TypeAffinity.Int64, TypeAffinity.Int64, TypeAffinity.Double, TypeAffinity.Double, TypeAffinity.Double, TypeAffinity.DateTime, TypeAffinity.Null, TypeAffinity.Text }; SQLiteConvert._typecodeAffinities = typeAffinityArray; SQLiteConvert._syncRoot = new object(); SQLiteConvert._typeNames = null; }
public static double ToJulianDay(DateTime value) { return(SQLiteConvert.JdToDouble(SQLiteConvert.computeJD(value))); }