The OpenD Programming Language

PosixTimeZone.getTimeZone

Returns a TimeZone with the give name per the TZ Database. The time zone information is fetched from the TZ Database time zone files in the given directory.

class PosixTimeZone
static @trusted
immutable(PosixTimeZone)
getTimeZone

Parameters

name string

The TZ Database name of the desired time zone

tzDatabaseDir string

The directory where the TZ Database files are located. Because these files are not located on Windows systems, provide them and give their location here to use PosixTimeZones.

Throws

std.datetime.date.DateTimeException if the given time zone could not be found or FileException if the TZ Database file could not be opened.

Examples

version (Posix)
{
    auto tz = PosixTimeZone.getTimeZone("America/Los_Angeles");

    assert(tz.name == "America/Los_Angeles");
    assert(tz.stdName == "PST");
    assert(tz.dstName == "PDT");
}

See Also

Meta