标签上的当前时间(特定时区)

时间:2014-11-08 07:44:57

标签: ios xcode label nstimer nstimezone

我正在第一页上创建一个iOS应用,我想显示特定国家/地区时区的当前时间

标签上的

我需要编程才能使标签上只显示时间(HH:MM)。我的具体国家

时区是泰国曼谷(格林尼治标准时间+7)。谢谢你的帮助! :)

This is screen shot link to the label. I haven't program anything yet 

https://www.dropbox.com/s/wnyq0m9s9dkk0eb/Screen%20Shot%202014-11-08%20at%202.41.50%20PM.png?dl=0

1 个答案:

答案 0 :(得分:0)

// retrive the time regarding info.
NSDate *t = [NSDate date];
NSDateFormatter *df = [[NSDateFormatter alloc] init];
// line below formats your time.
[dateFormatter setTimeStyle:NSDateFormatterShortStyle];
// now get the current time fomated 
NSString *ct = [df stringFromDate:t];
NSLog(@"%@",ct);

// set your label
self.lbl.text = ct;