【发布时间】:2012-10-24 09:48:18
【问题描述】:
我正在开发一个 iPhone 应用程序,它需要将时间数据与客户端时区一起存储在远程 mysql 数据库中。 这是通过调用 php web 服务并将数据存储在 mysql 数据库中来实现的。查找用户时区并发送到网络服务的最佳方式是什么。
编辑:
NSTimeZone *tzone = [NSTimeZone defaultTimeZone];
NSTimeInterval timeInt = [dateTime timeIntervalSince1970 ];
NSNumber *timeStamp=[NSNumber numberWithInt:timeInt];
NSString *zone = [tzone name];
NSURL *url = [NSURL URLWithString:@"http://localhost/mytask/"];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setPostValue:[NSString stringWithFormat:@"%@", timeStamp] forKey:@"task_time_stamp"];
[request setPostValue:zone forKey:@"task_time_zone"];
如何使用客户端时区在 MySql 数据库中保存时间戳。有没有其他方法。
【问题讨论】:
-
这是一个通知应用程序,我的问题是在特定时间发送电子邮件。如果我从 iPhone 存储时间戳,它将与网络服务器时间不同。
标签: php mysql objective-c web-services timezone