ZoneId.systemDefault constructor
ZoneId.systemDefault()
Returns a ZoneId representing the system's current default time zone.
This uses DateTime.now().timeZoneName
under the hood, which may return
localized abbreviations like 'PDT', 'CET', etc.
Example:
ZoneId current = ZoneId.systemDefault();
print(current); // e.g., "PDT"
Represents a time zone identifier, abstracting the concept of region-based or offset-based zone IDs (e.g., 'UTC', 'America/New_York').
The ZoneId
class allows specifying or retrieving time zone information
in a controlled and type-safe manner.
Example:
ZoneId utc = ZoneId.of('UTC');
print(utc.id); // Output: UTC
ZoneId systemZone = ZoneId.systemDefault();
print(systemZone); // Output: e.g., "PDT", "CET", depending on system
Implementation
factory ZoneId.systemDefault() {
return ZoneId._(DateTime.now().timeZoneName);
}