ios - NSDataDetector & NSDate returning current date -


I am trying to use an NSString that has a date / time, and create an NSDate object from it, I can manipulate accordingly accordingly

I have not used NSDataDetector in the past with any issue, however, when I try it now, it has come to know that the current date is returning to the date given in the string.

Can anyone please explain why this string will not return the date as I have used in the past? Or how to get the best advice?

Many thanks.

  NSString * myDate = @ "2014-03-13T12: 31: 00-07: 00"; __bloc NSDate * detected; NSDataDetector * Detector = [NSDataDetector dataDetectorWithTypes: NSTextCheckingAllTypes Error: Zero]; [Detector Mats Instreaming: Meridate Options: Canil Option Range: Block using NSMKrange (0, [Maiden Lettness]): (NSTExcinning Result * Result, NSmaking Flags Flags, Balls * Stop) {Detected = ResultsDate; }]; NSLog (@ "Result:% @", detectedDate);  

View replies from @gaige in comments, who said: - < P> I did a quick test by removing "T" from the string on it and captured it on the exact date. Unless you know that you are getting the date of an ISO format in a block of text (as opposed to some formatted data), then you are probably fine. For the formatted data where you know that you are getting a date, I suggest Peter Hossey's ISO 8601 NSDATFFORMER as the excellent percing choice.

Thank you.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -