How do I parse
2018-10-01T00:00:00Z
Into an instance of DateTime
I've tried:
DateTime.valueOfGmt('2018-10-01T00:00:00Z');
DateTime.parse('2018-10-01T00:00:00Z');
DateTime.valueOf('2018-10-01T00:00:00Z');
DateTime.valueOfGmt('2018-10-01T00:00:00Z');
And I always get error:
ERROR: System.TypeException: Invalid date/time: 2018-10-01T00:00:00Z
Best Answer
Note the extra set of double quotes - they allow the JSON parser to interpret that value.