i want to get date in 2 labels like this
Label1:-> Tuesday
Label2:-> 2 June 2010
how can i get this value?
i want to get date in 2 labels like this
Label1:-> Tuesday
Label2:-> 2 June 2010
how can i get this value?
[label1 setText:@"Tuesday"];
[label2 setText:@"2 June 2010"];
Or did you need something different?
This code will get you the strings you require to set the labels:
NSDate *today = [NSDate date];
NSDateFormatter *weekdayFormatter = [[[NSDateFormatter alloc] init] autorelease];
NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease];
[formatter setDateFormat: @"d MMMM yyyy"];
[weekdayFormatter setDateFormat: @"EEEE"];
NSString *formattedDate = [formatter stringFromDate: today];
NSString *weekday = [weekdayFormatter stringFromDate: today];
The date formatters are controlled through this standard: Unicode Date Formats