Search code examples
c#datetimetimestampkendo-scheduler

Convert to DateTime using c#


I have a string which looks like 20130611T150000Z which is nothing but 2013 - 06 - 11- 15:00:00 in UTC time. How can I convert this to DateTime using c#? I am getting this value from kendoScheduler.


Solution

  • Use the ParseExact method. Example:

    string d = "20130611T150000Z";
    
    DateTime t = DateTime.ParseExact(d, "yyyyMMdd'T'HHmmss'Z'", CultureInfo.InvariantCulture);