currentDateTime = [NSDate date];
dateFormatter = [[NSDateFormatter alloc]init] ;
[dateFormatter setDateFormat:@"yyyy-mm-dd hh:mm"]; // 1999-12-12 14:50
dateInString = [dateFormatter stringFromDate:currentDateTime];
metTime.text=dateInString;
NSLog(@"date %@", dateInString);
I try send the current time to web service method as a string paramater. I can see it but when pass dateInString I got an error such as
System.Web.Services.Protocols.SoapException: Server was unable to process request. —> System.FormatException: String was not recognized as a valid DateTime.
at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
at System.Convert.ToDateTime(String value)
at MrkService.MrkService.AddMeetingInfo(String phoId, Int32 metId, Int32 cusId, Int32 metTyp, Int32 metRes, String desc, String contc, String endTime)
— End of inner exception stack trace —
is there anyone know this problem (web service method parameter is string not date)
This pattern looks very wrong to me:
See how you’re using “mm” twice? And “hh” normally means the 12 hour clock… I suspect you want
where MM means the month (not the minute) and HH means the 24 hour clock. That’s assuming that iOS date and time patterns work similarly to other platforms…
In fact, you may need to make further changes to the pattern – for instance to include seconds, and possibly a T, e.g.