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
  • 214,338
  • 71
  • 421
  • 539
Emil Elkjær
  • 667
  • 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,521
  • 1
  • 15
  • 24
2

use DateTime.ParseExact

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

also see this question

Community
  • 1
  • 1
Jason
  • 79,175
  • 14
  • 122
  • 139
-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,403
  • 1
  • 10
  • 29