{
    "mode": "perldoc",
    "parameter": "DateTime::TimeZone::Local",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/DateTime%3A%3ATimeZone%3A%3ALocal/json",
    "generated": "2026-06-13T20:08:13Z",
    "synopsis": "my $tz = DateTime::TimeZone->new( name => 'local' );\nmy $tz = DateTime::TimeZone::Local->TimeZone();",
    "sections": {
        "NAME": {
            "content": "DateTime::TimeZone::Local - Determine the local system's time zone\n",
            "subsections": []
        },
        "VERSION": {
            "content": "version 2.51\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "my $tz = DateTime::TimeZone->new( name => 'local' );\n\nmy $tz = DateTime::TimeZone::Local->TimeZone();\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module provides an interface for determining the local system's time zone. Most of the\nfunctionality for doing this is in OS-specific subclasses.\n",
            "subsections": []
        },
        "USAGE": {
            "content": "This class provides the following methods:\n\nDateTime::TimeZone::Local->TimeZone()\nThis attempts to load an appropriate subclass and asks it to find the local time zone. This\nmethod is called by when you pass \"local\" as the time zone name to \"DateTime:TimeZone->new()\".\n\nIf your OS is not explicitly handled, you can create a module with a name of the form\n\"DateTime::TimeZone::Local::$^O\". If it exists, it will be used instead of falling back to the\nUnix subclass.\n\nIf no OS-specific module exists, we fall back to using the Unix subclass.\n\nSee DateTime::TimeZone::Local::Unix, DateTime::TimeZone::Local::Android,\nDateTime::TimeZone::Local::hpux, DateTime::TimeZone::Local::Win32, and\nDateTime::TimeZone::Local::VMS for OS-specific details.\n",
            "subsections": []
        },
        "SUBCLASSING": {
            "content": "If you want to make a new OS-specific subclass, there are several methods provided by this\nmodule you should know about.\n\n$class->Methods()\nThis method should be provided by your class. It should provide a list of methods that will be\ncalled to try to determine the local time zone.\n\nEach of these methods is expected to return a new \"DateTime::TimeZone\" object if it can\nsuccessfully determine the time zone.\n\n$class->FromEnv()\nThis method tries to find a valid time zone in an %ENV value. It calls \"$class->EnvVars()\" to\ndetermine which keys to look at.\n\nTo use this from a subclass, simply return \"FromEnv\" as one of the items from\n\"$class->Methods()\".\n\n$class->EnvVars()\nThis method should be provided by your subclass. It should return a list of env vars to be\nchecked by \"$class->FromEnv()\".\n\nYour class should always include the \"TZ\" key as one of the variables to check.\n\n$class->IsValidName($name)\nGiven a possible time zone name, this returns a boolean indicating whether or not the name looks\nvalid. It always return false for \"local\" in order to avoid infinite loops.\n",
            "subsections": []
        },
        "EXAMPLE SUBCLASS": {
            "content": "Here is a simple example subclass:\n\npackage DateTime::TimeZone::SomeOS;\n\nuse strict;\nuse warnings;\n\nuse base 'DateTime::TimeZone::Local';\n\n\nsub Methods { qw( FromEnv FromEther ) }\n\nsub EnvVars { qw( TZ ZONE ) }\n\nsub FromEther\n{\nmy $class = shift;\n\n...\n}\n",
            "subsections": []
        },
        "SUPPORT": {
            "content": "Bugs may be submitted at <https://github.com/houseabsolute/DateTime-TimeZone/issues>.\n",
            "subsections": []
        },
        "SOURCE": {
            "content": "The source code repository for DateTime-TimeZone can be found at\n<https://github.com/houseabsolute/DateTime-TimeZone>.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Dave Rolsky <autarch@urth.org>\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENSE": {
            "content": "This software is copyright (c) 2021 by Dave Rolsky.\n\nThis is free software; you can redistribute it and/or modify it under the same terms as the Perl\n5 programming language system itself.\n\nThe full text of the license can be found in the LICENSE file included with this distribution.\n",
            "subsections": []
        }
    },
    "summary": "DateTime::TimeZone::Local - Determine the local system's time zone",
    "flags": [],
    "examples": [],
    "see_also": []
}