DateTi...teParse(3pm)

πŸ’… NAME πŸ’…

DateTime::Format::DateParse β€” the module that parses Date::Parse-compatible formats, no cap. Fr fr it's a compatibility wrapper, and it lives over in the User Contributed Perl Documentation corner of the man pages πŸŽ€


✨ SYNOPSIS ✨

use DateTime::Format::DateParse;

my $dt = DateTime::Format::DateParse->parse_datetime( $date );
my $dt = DateTime::Format::DateParse->parse_datetime( $date, $zone );

That's literally it. Two lines of code and you're slaying πŸ¦‹


🌸 DESCRIPTION 🌸

So basically: this module is a compatibility wrapper around Date::Parse. That's the whole vibe. It doesn't reinvent anything, it just makes Date::Parse play nicely with DateTime, and honestly? Iconic behaviour 🫢


πŸŽ€ USAGE πŸŽ€

πŸ’– Import Parameters πŸ’–

This module accepts no arguments at all to its import method, and it exports zero symbols. Nothing. Nada. So don't come at it with a big import list, she's not that kind of girl πŸ™ˆ

πŸ’œ Methods πŸ’œ

πŸ‘‘ Class Methods πŸ‘‘

  • parse_datetime($date [, $zone]) β€” takes a Date::Parse-compatible $date string, and optionally a Time::Zone-compatible $zone string. It hands you back a DateTime object. That's the whole deal, and it eats every time πŸ’…

πŸ’€ GOTCHAS πŸ’€

Bestie, read these. They will absolutely catch you out if you skip them 😭
  • If parse_datetime gets called on a $date that doesn't specify a timezone and $zone is not set, then the timezone of the returned DateTime object gets set to the local timezone. This is consistent with the behaviour of Date::Parse β€” so it's not a bug, it's a vibe match 🧚
  • If parse_datetime is called without a $zone but the $date string does specify a timezone/offset β€” or if parse_datetime is called with a $zone that DateTime::TimeZone does not understand β€” then the returned DateTime object will have its timezone set to a fixed offset from UTC. Which means: no DST information is available, and date math will not reflect DST transitions. Lowkey a big deal for date math, ngl. This may be resolved for true timezones by using the DateTime::TimeZone::Alias module to "alias" the Time::Zone timezone to an Olson DB name. And this may be done automatically in a future release ✨

🌈 CREDITS 🌈

  • Graham Barr (GBARR) <gbarr@pobox.com> β€” author of Date::Parse πŸ‘‘
  • Everyone at the DateTime "Asylum" 🫢

πŸ“¬ SUPPORT πŸ“¬

Support for this module is provided via the <datetime@perl.org> email list. See <http://lists.perl.org/> for more details πŸ’Œ


πŸ¦‹ AUTHOR πŸ¦‹

Joshua Hoblitt (JHOBLITT) <jhoblitt@cpan.org>


Copyright (c) 2005-6 Joshua Hoblitt. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the licenses can be found in the LICENSE file included with this module, or in perlartistic and perlgpl as supplied with Perl 5.8.1 and later πŸ’œ


🌸 SEE ALSO 🌸

Date::Parse, Time::Zone, DateTime, DateTime::TimeZone, DateTime::TimeZone::Alias, <http://datetime.perl.org/>


And that's the whole page, bestie! This one's brought to you by perl v5.42.0, dated 2011-12-14 β€” a lil vintage, but she still slays βœ¨πŸ’– Go parse something cute πŸŽ€

πŸ“¦ where this page comes from