{
    "mode": "perldoc",
    "parameter": "DateTime::Format::HTTP",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/DateTime%3A%3AFormat%3A%3AHTTP/json",
    "generated": "2026-06-14T07:47:47Z",
    "synopsis": "use DateTime::Format::HTTP;\nmy $class = 'DateTime::Format::HTTP';\n$string = $class->formatdatetime($dt); # Format as GMT ASCII time\n$time = $class->parsedatetime($string); # convert ASCII date to machine time",
    "sections": {
        "NAME": {
            "content": "DateTime::Format::HTTP - Date conversion routines\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use DateTime::Format::HTTP;\n\nmy $class = 'DateTime::Format::HTTP';\n$string = $class->formatdatetime($dt); # Format as GMT ASCII time\n$time = $class->parsedatetime($string); # convert ASCII date to machine time\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module provides functions that deal the date formats used by the HTTP protocol (and then\nsome more).\n",
            "subsections": []
        },
        "METHODS": {
            "content": "parsedatetime( $str [, $zone] )\nThe parsedatetime() function converts a string to machine time. It throws an error if the\nformat of $str is unrecognized, or the time is outside the representable range. The time formats\nrecognized are listed below.\n\nThe function also takes an optional second argument that specifies the default time zone to use\nwhen converting the date. This parameter is ignored if the zone is found in the date string\nitself. If this parameter is missing, and the date string format does not contain any zone\nspecification, then the floating time zone is used.\n\nThe zone should be one that is recognized by DateTime::TimeZone.\n\nActual parsing is done with the HTTP::Date module. At the time of writing it supports the\nformats listed next. Consult that module's documentation in case the list has been changed.\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 the seconds to be missing and\nthe month to be numerical in most formats.\n\nIf the year is missing, then we assume that the date is the first matching date *before* current\nmonth. If the year is given with only 2 digits, then parsedate() will select the century that\nmakes the year closest to the current date.\n\nformatdatetime()\nThe \"formatdatetime()\" method converts a DateTime to a string. If the function is called\nwithout an argument, it will use the current time.\n\nThe string returned is in the format preferred for the HTTP protocol. This is a fixed length\nsubset of the format defined by RFC 1123, represented in Universal Time (GMT). An example of a\ntime stamp in this format is:\n\nSun, 06 Nov 1994 08:49:37 GMT\n\nformatiso( [$time] )\nSame as formatdatetime(), but returns a \"YYYY-MM-DD hh:mm:ss\"-formatted string representing\ntime in the local time zone. It is strongly recommended that you use \"formatisoz\" or\n\"formatdatetime\" instead (as these provide time zone indication).\n\nformatisoz( [$dt] )\nSame as formatiso(), but returns a \"YYYY-MM-DD hh:mm:ssZ\"-formatted string representing\nUniversal Time.\n",
            "subsections": []
        },
        "THANKS": {
            "content": "Gisle Aas (GAAS) for writing HTTP::Date.\n\nIain, for never quite finishing \"HTTP::Date::XS\".\n",
            "subsections": []
        },
        "SUPPORT": {
            "content": "Support for this module is provided via the datetime@perl.org email list. See\nhttp://lists.perl.org/ for more details.\n\nAlternatively, log them via the CPAN RT system via the web or email:\n\nhttp://rt.cpan.org/NoAuth/ReportBug.html?Queue=DateTime%3A%3AFormat%3A%3AHTTP\nbug-datetime-format-http@rt.cpan.org\n\nThis makes it much easier for me to track things and thus means your problem is less likely to\nbe neglected.\n",
            "subsections": []
        },
        "LICENCE AND COPYRIGHT": {
            "content": "Copyright Iain Truskett, 2003. All rights reserved. Sections of the documentation Gisle Aas,\n1995-1999. Changes since version 0.35 copyright David Rolsky, 2004.\n\nThis library is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself, either Perl version 5.000 or, at your option, any later version of Perl 5 you may\nhave available.\n\nThe full text of the licences can be found in the Artistic and COPYING files included with this\nmodule, or in perlartistic and perlgpl as supplied with Perl 5.8.1 and later.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Originally written by Iain Truskett <spoon@cpan.org>, who died on December 29, 2003.\n\nMaintained by Dave Rolsky <autarch@urth.org> and Christiaan Kras <ckras@cpan.org>\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "\"datetime@perl.org\" mailing list.\n\nhttp://datetime.perl.org/\n\nperl, DateTime, HTTP::Date, DateTime::TimeZone.\n",
            "subsections": []
        }
    },
    "summary": "DateTime::Format::HTTP - Date conversion routines",
    "flags": [],
    "examples": [],
    "see_also": []
}