2017-04-22 1 views
0

J'ai un attribut est l'heure de la date sur ce format "2017-06-23 15:34:48" .can et je l'ai mis à NSDate. Mais la valeur est insérait sur la table quelqu'un peut me aider j'ai ajouté cet objet comme NSDateComment insérer un horodatage dans les données de base

2017-06-23 15:34:48 I want to insert on this format. 
+0

Voir http://stackoverflow.com/questions/2135267/nsdateformatter -avec 24 heures – vadian

Répondre

0

Ma solution:

NSDateFormatter *df = [[NSDateFormatter alloc] init]; 
[df setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; 
NSDate *myDate = [df dateFromString:@"2017-06-23 15:34:48"]; 
NSLog(@"%@", myDate);