Formateo de fecha en iPhone SDk

I'm working on one iPhone application that includes date formatting. Here i'm getting date string from the server that i need to change and display of the formatted date.

Please find the below date m getting from the server

Server Date: Sat Apr 23 16:35:33 +0000 2011

This date i need to display like 2:35 AM Apr 23rd

Can anyone please help in this.

Gracias de antemano.

preguntado el 08 de noviembre de 11 a las 09:11

1 Respuestas

Deberías usar un NSDateFormatter to parse the date string you get from the server and get the corresponding NSDate (a través de -[NSDateFormatter dateFromString:]). You would then use a second NSDateFormatter para convertir el NSDate a una NSString with the desired date format. Unless you absolutely require a very specific display format, you should use +[NSDateFormatter dateFormatFromTemplate:options:locale:] to get a date format that a) includes all the details you want it to include and b) respects the user’s locale settings. For instance, some users might prefer a 24-hour format instead of the 12-hour format with an AM/PM designation.

respondido 08 nov., 11:14

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.