【发布时间】:2011-12-05 18:23:34
【问题描述】:
我们有 .NET 代码 (C#) 写入 SQLite 数据库,然后由带有 Objective-c 的 iOS (iPhone) 应用程序读取。
SQLite 中使用的日期格式是 NSTimeInterval(使用 dateWithIntervalSince1970 表示 NSDate),因为它在 iPhone 上很有效。
如何将.NET DateTime 转换为 NSTimeInterval 以便在使用 dateWithIntervalSince1970 提取时日期正确?
注意事项: 1)我试图搜索 NSTimeInterval 的基本工作原理,但只找到这个不透明的文档: http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_DataTypes/Reference/reference.html
2) 尽管 C# 代码是理想的我很乐意使用从 3 个整数(年/月/日)到双精度的伪代码。
【问题讨论】: