0

I am currently working on a app which should be able to scan some codes, QR etc.

However when I am scanning a VEVENT code the date format is looking like this:

20140713T190000Z

My question is basicly how I can convert this into a normal DateTime which I can use to add events to the calender?

Thanks in advance

Matt Johnson-Pint
  • 230,703
  • 74
  • 448
  • 575
Emil Elkjær
  • 685
  • 1
  • 9
  • 31
  • possible duplicate of [How to create a .Net DateTime from ISO 8601 format](http://stackoverflow.com/questions/3556144/how-to-create-a-net-datetime-from-iso-8601-format) – Matt Johnson-Pint Jun 18 '14 at 21:05

3 Answers3

4

Try this for c#

NSDateFormatter dateFormat = new NSDateFormatter();
dateFormat.DateFormat = "d MMM yyyy";  
dateFormat.ToString(picker.Date);
Mohamed Mohaideen AH
  • 2,527
  • 1
  • 16
  • 24
2

use DateTime.ParseExact

DateTime d = DateTime.ParseExact("20140713T190000Z","yyyyMMdd'T'HHmmss'Z'",null);

also see this question

Community
  • 1
  • 1
Jason
  • 86,222
  • 15
  • 131
  • 146
-2

use following code:

NSDate *currDate = [NSDate date];
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
    [dateFormatter setDateFormat:@"dd.MM.YY HH:mm:ss"];
    NSString *dateString = [dateFormatter stringFromDate:currDate];

    yourLabel.text=dateString;
Ravi
  • 2,441
  • 1
  • 11
  • 30