2012-05-10 60 views

回答

0

this document这将有助于你

+0

谢谢,但我正在寻找一个日期选择器,将呈现 - 也 - 周日名称。代码只是为了得到工作日不会真的帮我在这里.. –

-3

您可以使用该选项DD。 例如。

$.datepicker.formatDate('DD', new Date(2007, 1 - 1, 26)); 

希望这会帮助你。 UI/Datepicker/formatDate

+1

这个问题指出目标c和iphone不是jquery – automaticoo

4

我觉得你不能DayName(例如星期天)与年 - 月日,直到你不完全自定义,但你可以通过下面的代码得到的日期与日期可能会帮助你。

绑定以下两个IBOutlet中的厦门国际银行。

和绑定方法-

-(IBAction)GetDateWithDay 
{ 

    NSDate* dt = datePicker.date; 
    NSDateFormatter* df = [[[NSDateFormatter alloc]init]autorelease]; 
    [df setDateFormat:@"yyyy-MM-dd"]; 

    NSCalendar *calendar = [NSCalendar currentCalendar]; 
    NSInteger units = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSWeekdayCalendarUnit; 
    NSDateComponents *components = [calendar components:units fromDate:dt]; 
    NSInteger year = [components year]; 
    NSInteger day = [components day]; 

    NSDateFormatter *weekDay = [[[NSDateFormatter alloc] init] autorelease]; 
    [weekDay setDateFormat:@"EEEE"]; 

    NSDateFormatter *calMonth = [[[NSDateFormatter alloc] init] autorelease]; 
    [calMonth setDateFormat:@"MM"]; 

    lblDate.text = [NSString stringWithFormat:@"%@, %i-%@-%i",[weekDay stringFromDate:dt], day, [calMonth stringFromDate:dt], year]; 

(IBAction为)GetDateWithDay的DatePickerValueChange attribut

在h文件

IBOutlet UIDatePicker* datePicker; 
IBOutlet UILabel* lblDate; 

在.m文件}

+0

谢谢!我会尝试一下 :) –

相关问题