{
    "content": [
        {
            "type": "text",
            "text": "# DateTime::TimeZone (perldoc)\n\n## NAME\n\nDateTime::TimeZone - Time zone object base class and factory\n\n## SYNOPSIS\n\nuse DateTime;\nuse DateTime::TimeZone;\nmy $tz = DateTime::TimeZone->new( name => 'America/Chicago' );\nmy $dt = DateTime->now();\nmy $offset = $tz->offsetfordatetime($dt);\n\n## DESCRIPTION\n\nThis class is the base class for all time zone objects. A time zone is represented internally as\na set of observances, each of which describes the offset from GMT for a given time period.\n\n## Sections\n\n- **NAME**\n- **VERSION**\n- **SYNOPSIS**\n- **DESCRIPTION** (1 subsections)\n- **USAGE** (1 subsections)\n- **LOADING TIME ZONES IN A PRE-FORKING SYSTEM**\n- **CREDITS**\n- **SEE ALSO**\n- **SUPPORT**\n- **SOURCE**\n- **DONATIONS**\n- **AUTHOR**\n- **CONTRIBUTORS**\n- **COPYRIGHT AND LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "DateTime::TimeZone",
        "section": "",
        "mode": "perldoc",
        "summary": "DateTime::TimeZone - Time zone object base class and factory",
        "synopsis": "use DateTime;\nuse DateTime::TimeZone;\nmy $tz = DateTime::TimeZone->new( name => 'America/Chicago' );\nmy $dt = DateTime->now();\nmy $offset = $tz->offsetfordatetime($dt);",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 7,
                "subsections": [
                    {
                        "name": "Special Case Platforms",
                        "lines": 7
                    }
                ]
            },
            {
                "name": "USAGE",
                "lines": 163,
                "subsections": [
                    {
                        "name": "Storable Hooks",
                        "lines": 6
                    }
                ]
            },
            {
                "name": "LOADING TIME ZONES IN A PRE-FORKING SYSTEM",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "CREDITS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "SUPPORT",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "SOURCE",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "DONATIONS",
                "lines": 15,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "CONTRIBUTORS",
                "lines": 36,
                "subsections": []
            },
            {
                "name": "COPYRIGHT AND LICENSE",
                "lines": 7,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "DateTime::TimeZone - Time zone object base class and factory\n",
                "subsections": []
            },
            "VERSION": {
                "content": "version 2.51\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use DateTime;\nuse DateTime::TimeZone;\n\nmy $tz = DateTime::TimeZone->new( name => 'America/Chicago' );\n\nmy $dt = DateTime->now();\nmy $offset = $tz->offsetfordatetime($dt);\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This class is the base class for all time zone objects. A time zone is represented internally as\na set of observances, each of which describes the offset from GMT for a given time period.\n\nNote that without the DateTime module, this module does not do much. It's primary interface is\nthrough a DateTime object, and most users will not need to directly use \"DateTime::TimeZone\"\nmethods.\n",
                "subsections": [
                    {
                        "name": "Special Case Platforms",
                        "content": "If you are on the Win32 platform, you will want to also install\nDateTime::TimeZone::Local::Win32. This will enable you to specify a time zone of 'local' when\ncreating a DateTime object.\n\nIf you are on HPUX, install DateTime::TimeZone::HPUX. This provides support for HPUX style time\nzones like 'MET-1METDST'.\n"
                    }
                ]
            },
            "USAGE": {
                "content": "This class has the following methods:\n\nDateTime::TimeZone->new( name => $tzname )\nGiven a valid time zone name, this method returns a new time zone blessed into the appropriate\nsubclass. Subclasses are named for the given time zone, so that the time zone \"America/Chicago\"\nis the DateTime::TimeZone::America::Chicago class.\n\nIf the name given is a \"link\" name in the Olson database, the object created may have a\ndifferent name. For example, there is a link from the old \"EST5EDT\" name to \"America/NewYork\".\n\nWhen loading a time zone from the Olson database, the constructor checks the version of the\nloaded class to make sure it matches the version of the current DateTime::TimeZone installation.\nIf they do not match it will issue a warning. This is useful because time zone names may fall\nout of use, but you may have an old module file installed for that time zone.\n\nThere are also several special values that can be given as names.\n\nIf the \"name\" parameter is \"floating\", then a \"DateTime::TimeZone::Floating\" object is returned.\nA floating time zone does not have *any* offset, and is always the same time. This is useful for\ncalendaring applications, which may need to specify that a given event happens at the same\n*local* time, regardless of where it occurs. See RFC 2445 <https://www.ietf.org/rfc/rfc2445.txt>\nfor more details.\n\nIf the \"name\" parameter is \"UTC\", then a \"DateTime::TimeZone::UTC\" object is returned.\n\nIf the \"name\" is an offset string, it is converted to a number, and a\n\"DateTime::TimeZone::OffsetOnly\" object is returned.\n\nThe \"local\" time zone\nIf the \"name\" parameter is \"local\", then the module attempts to determine the local time zone\nfor the system.\n\nThe method for finding the local zone varies by operating system. See the appropriate module for\ndetails of how we check for the local time zone.\n\n*   DateTime::TimeZone::Local::Unix\n\n*   DateTime::TimeZone::Local::Android\n\n*   DateTime::TimeZone::Local::hpux\n\n*   DateTime::TimeZone::Local::Win32\n\n*   DateTime::TimeZone::Local::VMS\n\nIf a local time zone is not found, then an exception will be thrown. This exception will always\nstringify to something containing the text \"\"Cannot determine local time zone\"\".\n\nIf you are writing code for users to run on systems you do not control, you should try to\naccount for the possibility that this exception may be thrown. Falling back to UTC might be a\nreasonable alternative.\n\nWhen writing tests for your modules that might be run on others' systems, you are strongly\nencouraged to either not use \"local\" when creating DateTime objects or to set $ENV{TZ} to a\nknown value in your test code. All of the per-OS classes check this environment variable.\n\n$tz->offsetfordatetime( $dt )\nGiven a \"DateTime\" object, this method returns the offset in seconds for the given datetime.\nThis takes into account historical time zone information, as well as Daylight Saving Time. The\noffset is determined by looking at the object's UTC Rata Die days and seconds.\n\n$tz->offsetforlocaldatetime( $dt )\nGiven a \"DateTime\" object, this method returns the offset in seconds for the given datetime.\nUnlike the previous method, this method uses the local time's Rata Die days and seconds. This\nshould only be done when the corresponding UTC time is not yet known, because local times can be\nambiguous due to Daylight Saving Time rules.\n\n$tz->isdstfordatetime( $dt )\nGiven a \"DateTime\" object, this method returns true if the DateTime is currently in Daylight\nSaving Time.\n\n$tz->name\nReturns the name of the time zone.\n\n$tz->shortnamefordatetime( $dt )\nGiven a \"DateTime\" object, this method returns the \"short name\" for the current observance and\nrule this datetime is in. These are names like \"EST\", \"GMT\", etc.\n\nIt is strongly recommended that you do not rely on these names for anything other than display.\nThese names are not official, and many of them are simply the invention of the Olson database\nmaintainers. Moreover, these names are not unique. For example, there is an \"EST\" at both -0500\nand +1000/+1100.\n\n$tz->isfloating\nReturns a boolean indicating whether or not this object represents a floating time zone, as\ndefined by RFC 2445 <https://www.ietf.org/rfc/rfc2445.txt>.\n\n$tz->isutc\nIndicates whether or not this object represents the UTC (GMT) time zone.\n\n$tz->hasdstchanges\nIndicates whether or not this zone has *ever* had a change to and from DST, either in the past\nor future.\n\n$tz->isolson\nReturns true if the time zone is a named time zone from the Olson database.\n\n$tz->category\nReturns the part of the time zone name before the first slash. For example, the\n\"America/Chicago\" time zone would return \"America\".\n\nDateTime::TimeZone->isvalidname($name)\nGiven a string, this method returns a boolean value indicating whether or not the string is a\nvalid time zone name. If you are using \"DateTime::TimeZone::Alias\", any aliases you've created\nwill be valid.\n\nDateTime::TimeZone->allnames\nThis returns a pre-sorted list of all the time zone names. This list does not include link\nnames. In scalar context, it returns an array reference, while in list context it returns an\narray.\n\nDateTime::TimeZone->categories\nThis returns a list of all time zone categories. In scalar context, it returns an array\nreference, while in list context it returns an array.\n\nDateTime::TimeZone->links\nThis returns a hash of all time zone links, where the keys are the old, deprecated names, and\nthe values are the new names. In scalar context, it returns a hash reference, while in list\ncontext it returns a hash.\n\nDateTime::TimeZone->namesincategory( $category )\nGiven a valid category, this method returns a list of the names in that category, without the\ncategory portion. So the list for the \"America\" category would include the strings \"Chicago\",\n\"Kentucky/Monticello\", and \"NewYork\". In scalar context, it returns an array reference, while\nin list context it returns an array.\n\nDateTime::TimeZone->countries()\nReturns a sorted list of all the valid country codes (in lower-case) which can be passed to\n\"namesincountry()\". In scalar context, it returns an array reference, while in list context it\nreturns an array.\n\nIf you need to convert country codes to names or vice versa you can use \"Locale::Country\" to do\nso. Note that one of the codes returned is \"uk\", which is an alias for the country code \"gb\",\nand is not a valid ISO country code.\n\nDateTime::TimeZone->namesincountry( $countrycode )\nGiven a two-letter ISO3166 country code, this method returns a list of time zones used in that\ncountry. The country code may be of any case. In scalar context, it returns an array reference,\nwhile in list context it returns an array.\n\nThis list is returned in an order vaguely based on geography and population. In general, the\nleast used zones come last, but there are not guarantees of a specific order from one release to\nthe next. This order is probably the best option for presenting zones names to end users.\n\nDateTime::TimeZone->offsetasseconds( $offset )\nGiven an offset as a string, this returns the number of seconds represented by the offset as a\npositive or negative number. Returns \"undef\" if $offset is not in the range \"-99:59:59\" to\n\"+99:59:59\".\n\nThe offset is expected to match either \"/^([\\+\\-])?(\\d\\d?):(\\d\\d)(?::(\\d\\d))?$/\" or\n\"/^([\\+\\-])?(\\d\\d)(\\d\\d)(\\d\\d)?$/\". If it doesn't match either of these, \"undef\" will be\nreturned.\n\nThis means that if you want to specify hours as a single digit, then each element of the offset\nmust be separated by a colon (:).\n\nDateTime::TimeZone->offsetasstring( $offset, $sep )\nGiven an offset as a number, this returns the offset as a string. Returns \"undef\" if $offset is\nnot in the range -359999 to 359999.\n\nYou can also provide an optional separator which will go between the hours, minutes, and seconds\n(if applicable) portions of the offset.\n",
                "subsections": [
                    {
                        "name": "Storable Hooks",
                        "content": "This module provides freeze and thaw hooks for \"Storable\" so that the huge data structures for\nOlson time zones are not actually stored in the serialized structure.\n\nIf you subclass \"DateTime::TimeZone\", you will inherit its hooks, which may not work for your\nmodule, so please test the interaction of your module with Storable.\n"
                    }
                ]
            },
            "LOADING TIME ZONES IN A PRE-FORKING SYSTEM": {
                "content": "If you are running an application that does pre-forking (for example with Starman), then you\nshould try to load all the time zones that you'll need in the parent process. Time zones are\nloaded on-demand, so loading them once in each child will waste memory that could otherwise be\nshared.\n",
                "subsections": []
            },
            "CREDITS": {
                "content": "This module was inspired by Jesse Vincent's work on Date::ICal::Timezone, and written with much\nhelp from the datetime@perl.org list.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "datetime@perl.org mailing list\n\nThe tools directory of the DateTime::TimeZone distribution includes two scripts that may be of\ninterest to some people. They are parseolson and testsfromzdump. Please run them with the\n--help flag to see what they can be used for.\n",
                "subsections": []
            },
            "SUPPORT": {
                "content": "Support for this module is provided via the datetime@perl.org email list.\n\nBugs 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": []
            },
            "DONATIONS": {
                "content": "If you'd like to thank me for the work I've done on this module, please consider making a\n\"donation\" to me via PayPal. I spend a lot of free time creating free software, and would\nappreciate any support you'd care to offer.\n\nPlease note that I am not suggesting that you must do this in order for me to continue working\non this particular software. I will continue to do so, inasmuch as I have in the past, for as\nlong as it interests me.\n\nSimilarly, a donation made in this way will probably not make me work on this software much\nmore, unless I get so many donations that I can consider working on free software full time\n(let's all have a chuckle at that together).\n\nTo donate, log into PayPal and send money to autarch@urth.org, or use the button at\n<https://www.urth.org/fs-donation.html>.\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Dave Rolsky <autarch@urth.org>\n",
                "subsections": []
            },
            "CONTRIBUTORS": {
                "content": "*   Alexey Molchanov <alexey.molchanov@gmail.com>\n\n*   Alfie John <alfiej@fastmail.fm>\n\n*   Andrew Paprocki <apaprocki@bloomberg.net>\n\n*   Bron Gondwana <brong@fastmail.fm>\n\n*   Daisuke Maki <dmaki@cpan.org>\n\n*   David Pinkowitz <dave@pinkowitz.com>\n\n*   Iain Truskett <deceased>\n\n*   Jakub Wilk <jwilk@jwilk.net>\n\n*   James E Keenan <jkeenan@cpan.org>\n\n*   Joshua Hoblitt <jhoblitt@cpan.org>\n\n*   Karen Etheridge <ether@cpan.org>\n\n*   karupanerura <karupa@cpan.org>\n\n*   kclaggett <kclaggett@proofpoint.com>\n\n*   Matthew Horsfall <wolfsage@gmail.com>\n\n*   Mohammad S Anwar <mohammad.anwar@yahoo.com>\n\n*   Olaf Alders <olaf@wundersolutions.com>\n\n*   Peter Rabbitson <ribasushi@cpan.org>\n\n*   Tom Wyant <wyant@cpan.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": []
            }
        }
    }
}