Date format in SQLite - iphone - How ?

Posted by sagar on Stack Overflow See other posts from Stack Overflow or by sagar
Published on 2010-05-10T06:42:04Z Indexed on 2010/05/10 7:04 UTC
Read the original article Hit count: 391

Filed under:
|
|
|
|

I know that - SQLite doesn't support Day name & month name. I have gone through this question. I have created two custom functions for it.

My custom function for Converting Day name from day number
( %w day of week 0-6 with sunday==0 )

+(NSString*)dayNameStringFromDayNo:(NSString*)dayNo{
    return 
    ([dayNo isEqualToString:@"0"])?@"Sunday":
    ( ([dayNo isEqualToString:@"1"])?@"Monday":
     ( ([dayNo isEqualToString:@"2"])?@"Tuesday":
      ( ([dayNo isEqualToString:@"3"])?@"Wednesday":
       ( ([dayNo isEqualToString:@"4"])?@"Thursday":
        ( ([dayNo isEqualToString:@"5"])?@"Friday": @"Saturday"
        )
       )
      )
     )
    );
}

My custom method for getting month name from month no string
( %m month: 01-12 )

+(NSString*)monthNameFromNumber:(NSString*)no{
    return ([no isEqualToString:@"01"])?@"January":
    ( ([no isEqualToString:@"02"])?@"February":
     ( ([no isEqualToString:@"03"])?@"March":
      ( ([no isEqualToString:@"04"])?@"April":
       ( ([no isEqualToString:@"05"])?@"May":
        ( ([no isEqualToString:@"06"])?@"June":
         ( ([no isEqualToString:@"07"])?@"July":
          ( ([no isEqualToString:@"08"])?@"August":
           ( ([no isEqualToString:@"09"])?@"September":
            ( ([no isEqualToString:@"10"])?@"October":
             ( ([no isEqualToString:@"11"])?@"November":@"Decemeber"
             )
            )
           )              
          )
         )
        )
       )
      )
     )
    );
}

But what about date following format.
Sat 6th February
How to get this kind of output ? Do I have to again create a custom function for it ?

Thanks in advance for sharing your knowledge.

Sagar.

© Stack Overflow or respective owner

Related posts about sqlite

Related posts about iphone