Time::gmtime(3perl)

πŸ‘‘ Time::gmtime β€” the by-name glow-up for gmtime()

okay bestie, gather round πŸ’– this is the manual page for Time::gmtime, living in section 3perl of the Perl Programmers Reference Guide. It's the by-name interface to Perl's built-in gmtime() function, and honestly? she's serving convenience.


✨ NAME ✨

Time::gmtime β€” by-name interface to Perl's built-in gmtime() function πŸ•°οΈ


🌸 SYNOPSIS 🌸

use Time::gmtime;
$gm = gmtime();
printf "The day in Greenwich is %s\n",
   (qw(Sun Mon Tue Wed Thu Fri Sat Sun))[ $gm->wday() ];

use Time::gmtime qw(:FIELDS);
gmtime();
printf "The day in Greenwich is %s\n",
   (qw(Sun Mon Tue Wed Thu Fri Sat Sun))[ $tm_wday ];

$now = gmctime();

use Time::gmtime;
use File::stat;
$date_string = gmctime(stat($file)->mtime);

look at that range. object vibes, field vibes, scalar vibes, and a little File::stat crossover episode. main character energy fr 🌈


πŸ’… DESCRIPTION πŸ’…

so here's the tea, bestie β˜• β€” this module's default exports override the core gmtime() function, swapping it out for a version that hands you back Time::tm objects instead. iconic behavior. That object has methods that return the similarly named structure field name from the C's tm structure out of time.h β€” and those fields are, in her full glory: sec, min, hour, mday, mon, year, wday, yday, and isdst. nine of them. all accounted for. no skips πŸ’€

You may also import all the structure fields directly into your namespace as regular variables using the :FIELDS import tag. 🫢 (heads up though: this still overrides your core functions. she's not being subtle about it.) You access these fields as variables named with a preceding tm_ in front of their method names. Thus, $tm_obj->mday() corresponds to $tm_mday if you import the fields. simple as that, no cap.

The gmctime() function provides a way of getting at the scalar sense of the original CORE::gmtime() function. ✨

And if you wanna access this functionality without the core overrides β€” like, respectfully, you'd rather nobody touched your core β€” you can pass the use an empty import list, and then access function functions with their full qualified names. On the other hand, the built-ins are still available via the CORE:: pseudo-package. πŸŽ€ so you're never actually stranded, she's got you.


πŸ¦‹ NOTE πŸ¦‹

While this class is currently implemented using the Class::Struct module to build a struct-like class, you shouldn't rely upon this. 🚨

like, she said what she said. it's an implementation detail, not a promise. don't build your whole life on it bestie 😭


πŸ“ AUTHOR πŸ“

Tom Christiansen 🌸


and that's the whole page, periodt. πŸ‘‘

this page comes from perl v5.44.0 and is dated 2026-10-17 β€” shoutout to the Perl Programmers Reference Guide for hosting, mwah πŸ’– ✨ πŸŽ€

πŸ“¦ where this page comes from
  • arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms