Time::M...trptime(3)

πŸ“¦ version 0.001, in alpine 3.24

okay so bestie, welcome to Time::M...trptime(3) β€” the User Contributed Perl Documentation page for Time::Moment::Role::Strptime, and it is literally giving β€œtiny role, big strptime energy” πŸ’…βœ¨

🌸 NAME 🌸

  • Time::Moment::Role::Strptime β€” strptime constructor for Time::Moment 🫢

✨ SYNOPSIS ✨

        use Time::Moment;
        use Role::Tiny ();

        my $class = Role::Tiny->create_class_with_roles('Time::Moment', 'Time::Moment::Role::Strptime');
        my $moment = $class->strptime('2019-06-01', '%Y-%m-%d');

πŸ’– DESCRIPTION πŸ’–

This role composes the strptime method, which parses the input string according to a strptime(3) format, and constructs a Time::Moment object. Slay.

By default the returned Time::Moment object is in UTC (possibly adjusted by a parsed offset); to interpret the parsed time in another time zone, you can use Time::Moment::Role::TimeZone:

        use Time::Moment;
        use Role::Tiny ();

        my $class = Role::Tiny->create_class_with_roles('Time::Moment',
          'Time::Moment::Role::Strptime', 'Time::Moment::Role::TimeZone');
        my $moment = $class->strptime($input, $format)->with_system_offset_same_local;

        use DateTime::TimeZone::Olson 'olson_tz';
        my $tz = olson_tz('America/Los_Angeles');
        my $moment = $class->strptime($input, $format)->with_time_zone_offset_same_local($tz);

πŸ¦‹ METHODS πŸ¦‹

πŸ’« strptime

        my $moment = $class->strptime($input, $format);

Parses the input string according to the strptime(3) format, and returns a Time::Moment object in UTC. Throws an exception on parsing or out-of-bounds errors. No cap, that part is important 😭

Currently, Time::Piece is used to implement strptime portably, but this is considered an implementation detail β€” do not make it your whole main character, iykyk.

πŸ› BUGS πŸ›

Report any issues on the public bugtracker. Bestie, if something is acting up, that is the spot πŸ’€

πŸ‘‘ AUTHOR πŸ‘‘

Dan Book <dbook@cpan.org> πŸ’–

This software is Copyright (c) 2019 by Dan Book.

This is free software, licensed under:

        The Artistic License 2.0 (GPL Compatible)

🌈 SEE ALSO 🌈

  • Time::Moment ⭐

and that’s the whole vibe check: this page came from perl v5.42.2, dated 2026-02-15 β€” periodt πŸ’…βœ¨

πŸ“¦ where this page comes from