I am having problems converting a string in the format ‘yyyy-MM-ddZ’ using VB.net.
For example I have the string ‘2007-10-21Z’.
Using CDate or TryParse it comes out to 10/20/2007 instead of 10/21/2007.
I’m not understanding how the Z affects the date string so that when it is parsed it results in the day before.
From what I understand Z specifies the zero timezone. But the date string has no time information. How does this work?
Try
DateTime.ParseExact(‘2007-10-21Z’, ‘yyyy-MM-ddZ’, CultureInfo.InvariantCulture);