在 Google App Engine 中,我有一个带有(auto_now_add=True). 在我 iPhone 上的 Objective-C 中,获取当前时间让我得到了我2012-04-17 6:55:01,而在 Python 上auto_now_add得到了我2012-04-17 11:55:01。
6:55是我的当地时间,我不确定 Python 日期的时区或格式。如何通过 Python 或 Objective-C 使两者匹配?
编辑:显然 Python 日期是 UTC 格式。但是我的 iPhone 日期是什么格式的?我[NSDate date]还以为是UTC?为什么我得到不同的结果?
编辑2:好的。需要在 Objective-C 中执行此操作
NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@"UTC"];
[formatter setTimeZone:timeZone];