{
    "mode": "perldoc",
    "parameter": "HTTP::Date",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/HTTP%3A%3ADate/json",
    "generated": "2026-05-30T10:07:46Z",
    "synopsis": "use HTTP::Date;\n$string = time2str($time);    # Format as GMT ASCII time\n$time = str2time($string);    # convert ASCII date to machine time",
    "sections": {
        "NAME": {
            "content": "HTTP::Date - HTTP::Date - date conversion routines\n",
            "subsections": []
        },
        "VERSION": {
            "content": "version 6.05\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use HTTP::Date;\n\n$string = time2str($time);    # Format as GMT ASCII time\n$time = str2time($string);    # convert ASCII date to machine time\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module provides functions that deal the date formats used by the\nHTTP protocol (and then some more). Only the first two functions,\ntime2str() and str2time(), are exported by default.\n\ntime2str( [$time] )\nThe time2str() function converts a machine time (seconds since\nepoch) to a string. If the function is called without an argument or\nwith an undefined argument, it will use the current time.\n\nThe string returned is in the format preferred for the HTTP\nprotocol. This is a fixed length subset of the format defined by RFC\n1123, represented in Universal Time (GMT). An example of a time\nstamp in this format is:\n\nSun, 06 Nov 1994 08:49:37 GMT\n\nstr2time( $str [, $zone] )\nThe str2time() function converts a string to machine time. It\nreturns \"undef\" if the format of $str is unrecognized, otherwise\nwhatever the \"Time::Local\" functions can make out of the parsed\ntime. Dates before the system's epoch may not work on all operating\nsystems. The time formats recognized are the same as for\nparsedate().\n\nThe function also takes an optional second argument that specifies\nthe default time zone to use when converting the date. This\nparameter is ignored if the zone is found in the date string itself.\nIf this parameter is missing, and the date string format does not\ncontain any zone specification, then the local time zone is assumed.\n\nIf the zone is not \"\"GMT\"\" or numerical (like \"-0800\" or \"+0100\"),\nthen the \"Time::Zone\" module must be installed in order to get the\ndate recognized.\n\nparsedate( $str )\nThis function will try to parse a date string, and then return it as\na list of numerical values followed by a (possible undefined) time\nzone specifier; ($year, $month, $day, $hour, $min, $sec, $tz). The\n$year will be the full 4-digit year, and $month numbers start with 1\n(for January).\n\nIn scalar context the numbers are interpolated in a string of the\n\"YYYY-MM-DD hh:mm:ss TZ\"-format and returned.\n\nIf the date is unrecognized, then the empty list is returned\n(\"undef\" in scalar context).\n\nThe function is able to parse the following formats:\n\n\"Wed, 09 Feb 1994 22:23:32 GMT\"       -- HTTP format\n\"Thu Feb  3 17:03:55 GMT 1994\"        -- ctime(3) format\n\"Thu Feb  3 00:00:00 1994\",           -- ANSI C asctime() format\n\"Tuesday, 08-Feb-94 14:15:29 GMT\"     -- old rfc850 HTTP format\n\"Tuesday, 08-Feb-1994 14:15:29 GMT\"   -- broken rfc850 HTTP format\n\n\"03/Feb/1994:17:03:55 -0700\"   -- common logfile format\n\"09 Feb 1994 22:23:32 GMT\"     -- HTTP format (no weekday)\n\"08-Feb-94 14:15:29 GMT\"       -- rfc850 format (no weekday)\n\"08-Feb-1994 14:15:29 GMT\"     -- broken rfc850 format (no weekday)\n\n\"1994-02-03 14:15:29 -0100\"    -- ISO 8601 format\n\"1994-02-03 14:15:29\"          -- zone is optional\n\"1994-02-03\"                   -- only date\n\"1994-02-03T14:15:29\"          -- Use T as separator\n\"19940203T141529Z\"             -- ISO 8601 compact format\n\"19940203\"                     -- only date\n\n\"08-Feb-94\"         -- old rfc850 HTTP format    (no weekday, no time)\n\"08-Feb-1994\"       -- broken rfc850 HTTP format (no weekday, no time)\n\"09 Feb 1994\"       -- proposed new HTTP format  (no weekday, no time)\n\"03/Feb/1994\"       -- common logfile format     (no time, no offset)\n\n\"Feb  3  1994\"      -- Unix 'ls -l' format\n\"Feb  3 17:03\"      -- Unix 'ls -l' format\n\n\"11-15-96  03:52PM\" -- Windows 'dir' format\n\nThe parser ignores leading and trailing whitespace. It also allow\nthe seconds to be missing and the month to be numerical in most\nformats.\n\nIf the year is missing, then we assume that the date is the first\nmatching date *before* current month. If the year is given with only\n2 digits, then parsedate() will select the century that makes the\nyear closest to the current date.\n\ntime2iso( [$time] )\nSame as time2str(), but returns a \"YYYY-MM-DD hh:mm:ss\"-formatted\nstring representing time in the local time zone.\n\ntime2isoz( [$time] )\nSame as time2str(), but returns a \"YYYY-MM-DD hh:mm:ssZ\"-formatted\nstring representing Universal Time.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "\"time\" in perlfunc, Time::Zone\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Gisle Aas <gisle@activestate.com>\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENSE": {
            "content": "This software is copyright (c) 1995-2019 by Gisle Aas.\n\nThis is free software; you can redistribute it and/or modify it under\nthe same terms as the Perl 5 programming language system itself.\n",
            "subsections": []
        }
    },
    "summary": "HTTP::Date - HTTP::Date - date conversion routines",
    "flags": [],
    "examples": [],
    "see_also": []
}