Problem in dateFormatter in Iphone sdk?

Posted by user133611 on Stack Overflow See other posts from Stack Overflow or by user133611
Published on 2010-04-20T10:12:31Z Indexed on 2010/04/20 10:13 UTC
Read the original article Hit count: 289

Filed under:

Hi Guys,

    Actually My code is:


else if(isExpense == YES)
{
    NSDate *strDate;
    strDate = [NSDate date];
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
    [dateFormatter setDateFormat:@"dd-MM-yyyy"];
    if([expense.date length] > 0) 
    {
        NSDate *date = [dateFormatter dateFromString:expense.date];
        datePicker.date = date; //Here date value is passing nil and Im getting Exception   
    }
    else 
    {
        datePicker.date = strDate;      
    }
}

Guys can anyone help to get out of this problem?????

Anyone's help will be much appreciated.

Thank You, Kiran.

© Stack Overflow or respective owner

Related posts about objective-c