Dancer2...re::Time(3)

πŸ’– Dancer2::Core::Time πŸ’–

okay bestie, pull up a chair because we're talking about Dancer2::Core::Time β€” a whole class whose entire job is handling the common helpers for time manipulations ✨. it lives in the User Contributed Perl Documentation corner of the manual world, and yes it's a real one, not a vibe. 🫢


🌸 VERSION 🌸

version 2.2.1 β€” that's the one, no cap. πŸ’…


✨ SYNOPSIS ✨

look at this absolute icon of a snippet:

my $time = Dancer2::Core::Time->new( expression => "1h" );
$time->seconds; # return 3600

that's it. that's the whole flex. one hour goes in, 3600 comes out, and the # return 3600 comment is literally right there in the source, we love a self-documenting moment. πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea, bestie. for consistency, whenever something needs to work with time, it needs to be expressed in seconds, with a timestamp. that's great for the machine and great for calculations, but lowkey it is not very handy for a human-being β€” think, like, someone staring at a configuration file at 2am wondering what 86400 means. 😭

so this class provides everything needed to translate any human-understandable expression into a number of seconds. it's giving translator, it's giving glow-up for your config files, it's giving main character energy. periodt. πŸ‘‘


πŸ’œ ATTRIBUTES πŸ’œ

⭐ seconds

Number of seconds represented by the object. defaults to 0. simple, clean, iconic.

⭐ epoch

The current epoch to handle. defaults to seconds + time β€” so it's doing the little math moment for you. 🧚

⭐ epoch... wait no, it's gmt_string πŸ’…

Convert the current value in epoch as a GMT string. yes bestie, GMT string, we love a timezone-honest queen. 🌈

⭐ expression

Required. πŸ”₯ this one is a human readable expression representing the number of seconds to provide.

The format supported is a number followed by an expression. it currently understands:

s second seconds sec secs
m minute minutes min mins
h hr hour hours
d day days
w week weeks
M month months
y year years
heads up bestie: Months and years are currently fixed at 30 and 365 days. This may change. so like, don't build your entire life plan on it, okay? πŸ™ˆ

Anything else is used verbatim as the expression of a number of seconds. no guessing, no converting, just vibes straight through. πŸ’€

Example:

2 hours, 3 days, 3d, 1 week, 3600, etc...

the etc... is literally in the docs and honestly? iconic. it's giving "you get the idea, bestie." πŸ“


🫢 AUTHOR 🫢

Dancer Core Developers β€” the group chat we all owe a thank-you note to. πŸ’–


This software is copyright (c) 2026 by Alexis Sukrieh.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay, genuinely. free software is the moment. 🌸


and that's the page, bestie!! this beauty is perl v5.42.3 and it was dated 2026-09-20 β€” go forth and convert your human time expressions into seconds, you absolute legend. πŸ’…βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from