formatISOToDateTime method

DateTime formatISOToDateTime()

Converts an ISO string to DateTime, ignoring timezone.

Example: "2025-08-20T14:30:00+02:00".formatISOToDateTime()DateTime(2025, 8, 20, 14, 30)

Implementation

DateTime formatISOToDateTime () {
  String isoDate = substring(0, length - 6).replaceAll('T', ' ');
  DateTime newDateTime = DateTime.parse(isoDate);

  return newDateTime;
}