Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update DateTime stored as strings to be output with the UTC kind #315

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rebelzach
Copy link

DateTime types that are stored as strings should mimick the behavior of dates stored as ticks.

Currently when requesting a date from a db connection where dates are stored as strings it returns the date in local time, which is unexpected, and not congruent with the behavior when storing DateTime as ticks

@@ -473,7 +473,7 @@ private object ReadCol(IDbStatement stmt, int index, ColType type, Type clrType)
{
return new DateTime(_sqlitePlatform.SQLiteApi.ColumnInt64(stmt, index), DateTimeKind.Utc);
}
return DateTime.Parse(_sqlitePlatform.SQLiteApi.ColumnText16(stmt, index), CultureInfo.InvariantCulture);
return DateTime.Parse(_sqlitePlatform.SQLiteApi.ColumnText16(stmt, index), CultureInfo.InvariantCulture).ToUniversalTime();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to use return DateTime.Parse(_sqlitePlatform.SQLiteApi.ColumnText16(stmt, index), CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal)

@@ -488,7 +488,7 @@ private object ReadCol(IDbStatement stmt, int index, ColType type, Type clrType)
}
else
{
value = DateTime.Parse(_sqlitePlatform.SQLiteApi.ColumnText16(stmt, index), CultureInfo.InvariantCulture);
value = DateTime.Parse(_sqlitePlatform.SQLiteApi.ColumnText16(stmt, index), CultureInfo.InvariantCulture).ToUniversalTime();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to use return DateTime.Parse(_sqlitePlatform.SQLiteApi.ColumnText16(stmt, index), CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants