穆罕默德 - Moh
穆罕默德 - Moh

Reputation: 1373

convert "yyyy-MM-ddTHH:mm:ssZ" to DateTime datatype

I use this code for convert "yyyy-MM-ddTHH:mm:ssZ" to DateTime datatype in C#:

string PurchaseDate == "2017-12-12T14:29:26Z";
datetime dt =  DateTime.ParseExact(PurchaseDate , "yyyy-MM-ddTHH:mm:ssZ", null);

i expect, dt fills with {12/12/2017 14:29:26 PM} but it fills with {12/12/2017 5:59:26 PM} ! why it change this time ?

Upvotes: 0

Views: 4007

Answers (1)

Luigi Dallavalle
Luigi Dallavalle

Reputation: 320

The trailing Z refers to the Zulu time. Zulu time is equivalent to the UTC (see here for further reference)

The parsing you're doing converts the datetime into the "local" timezone.

Upvotes: 1

Related Questions