Skip to content

Commit c98aaec

Browse files
committed
core/SQLiteCommand: Make the DateTime serialization format a const
1 parent 67a47c5 commit c98aaec

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/SQLite.Net/SQLiteCommand.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public class SQLiteCommand
3939

4040
private readonly SQLiteConnection _conn;
4141
private readonly ISQLitePlatform _sqlitePlatform;
42+
private const string DateTimeFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ";
4243

4344
internal SQLiteCommand(ISQLitePlatform platformImplementation, SQLiteConnection conn)
4445
{
@@ -349,7 +350,7 @@ internal static void BindParameter(ISQLiteApi isqLite3Api, IDbStatement stmt, in
349350
}
350351
else
351352
{
352-
string val = ((DateTime) value).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ", CultureInfo.InvariantCulture);
353+
string val = ((DateTime) value).ToUniversalTime().ToString(DateTimeFormat, CultureInfo.InvariantCulture);
353354
isqLite3Api.BindText16(stmt, index, val, -1, NegativePointer);
354355
}
355356
}
@@ -366,7 +367,7 @@ internal static void BindParameter(ISQLiteApi isqLite3Api, IDbStatement stmt, in
366367
}
367368
else
368369
{
369-
string val = ((ISerializable<DateTime>) value).Serialize().ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ", CultureInfo.InvariantCulture);
370+
string val = ((ISerializable<DateTime>) value).Serialize().ToUniversalTime().ToString(DateTimeFormat, CultureInfo.InvariantCulture);
370371
isqLite3Api.BindText16(stmt, index, val, -1, NegativePointer);
371372
}
372373
}

0 commit comments

Comments
 (0)