2012-05-10 62 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

謝謝!我會嘗試一下 :) –

相關問題