我使用下面的代码:如何SQLite.Net-PCL手柄UTC时间
使用新SQLite.Net.SQLiteConnection(新SQLitePlatformWinRT(),DBPATH),以获得SQLiteConnection 和创建表。
类包含日期时间数据类型
class Transaction
{
[SQLite.Net.Attributes.PrimaryKey, SQLite.Net.Attributes.AutoIncrement]
public int QId { get; set; }
public DateTime PurchaseDate { get; set; }
public int Amount {get;set;}
Public string ItemCode {get;set;}
}
插入数据如下:
var db = new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), DBPath);
var newItem = new Transaction()
{
PurchaseDate = DateTime.Now,
Amount = 100,
ItemCode = "Abc-C10"
};
db.Insert(newItem);
日期将被(636071680313888433 e.g)存储为蜱,这是UTC时间。使用上述DateTime.Now,如果我的电脑时间设置为
1A)在英国时间
1),
将上面的代码:购买= DateTime.Now正确转换?
1B)在美国时间,
将上面的代码:购买= DateTime.Now正确转换?
如何在SQL语句中处理此刻表?
如何从日期范围中选择所有交易?说,2016-07-10至2016-07-20?
感谢
你是什么意思“正确转换”?最正确的行为是没有转换。 –