toStringCompact method
Returns a compact string representation without the zone ID.
The format is: yyyy-MM-ddTHH:mm:ss±HH:mm
Example:
final zoned = ZonedDateTime.now(ZoneId.of('Europe/Paris'));
print(zoned.toStringCompact()); // 2023-12-25T15:30:45+01:00
Implementation
String toStringCompact() {
final offsetStr = _formatOffset(_offset);
return '$_localDateTime$offsetStr';
}