In my Windows 10 universal app i use the CalendarDatePicker to select a date:
<CalendarDatePicker x:Name="cdpStartDate" Width="150" />
In Code behind i use the following code to store the date to a SQLite database:
booking = new Bookings();
using (
SQLite.Net.SQLiteConnection conn =
new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), Common.Utils.DbPath()))
{
booking.StartDate = cdpStartDate.Date.ToDateTime();
conn.Update(booking);
}
My table class looks like this:
[Table("Bookings")]
public class Bookings
{
[PrimaryKey]
public int BookingId { get; set; }
[NotNull]
public DateTime StartDate { get; set; }
}
While debugging the value for booking.StartDate is 18.11.2015 00:00:00. But after saving the value to the SQLite database the value is converted to 17.11.2015 23:00:00. This seems to be Utc time. I do not need any time information in my app, just the Date only.
How can i save the date without conversion to my database?
Thanks, Uwe
Aucun commentaire:
Enregistrer un commentaire