DateTi...h::MJD(3pm)

πŸ“¦
version 0.16 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ‘‘ NAME πŸ‘‘

DateTime::Format::Epoch::MJD β€” bestie, it converts DateTimes to and from Modified Julian Days. That's it, that's the whole gig πŸ’–

This one lives in the User Contributed Perl Documentation section of your manual, btw, so you know it's community-made and community-loved 🫢


✨ SYNOPSIS ✨

okay so here's the whole vibe in code, no cap:

use DateTime::Format::Epoch::MJD;

my $dt = DateTime::Format::Epoch::MJD->parse_datetime( 53244 );
 # 2004-08-27T00:00:00

DateTime::Format::Epoch::MJD->format_datetime($dt);
 # 53244

my $formatter = DateTime::Format::Epoch::MJD->new();
my $dt2 = $formatter->parse_datetime( 53244 );
 # 2004-08-27T00:00:00
$formatter->format_datetime($dt2);
 # 53244

look at that. 53244 in, 2004-08-27T00:00:00 out. and back again. iconic behaviour, honestly πŸ’…


🌸 DESCRIPTION 🌸

so this module takes a DateTime object β€” or literally anything that can be converted into a DateTime object, it's not picky β€” and turns it into a Modified Julian Day number. and yes it goes the other way too, it's a whole two-way street πŸ¦‹

for the full ✨lore✨ on how it works, go read DateTime::Format::Epoch::JD β€” it has the description. this page is basically the MJD-flavoured sibling.


πŸ’… METHODS πŸ’…

most of the methods here are the exact same as the ones in DateTime::Format::Epoch. like, no changes, same energy. the only glow-up is the constructor:

  • new() β€” this is your constructor for the formatter/parser object. it takes no parameters. none. zero. empty. it just exists and does its thing, main character energy πŸ‘‘

🫢 SUPPORT 🫢

need help? got questions? the support for this module comes through the datetime@perl.org email list. head to http://lists.perl.org/ for more deets 🌈


πŸŽ€ AUTHOR πŸŽ€

Eugene van der Pijll <pijll@gmx.net> β€” thank you for your service, king/queen/royalty πŸ«‘πŸ’–


Copyright (c) 2004 Eugene van der Pijll. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. ✨ (yes bestie, free software, go wild, but respect the terms fr fr)


πŸ”₯ SEE ALSO πŸ”₯

  • DateTime
  • the datetime@perl.org mailing list

and that's a wrap!! this page came to you courtesy of perl v5.34.0 and it was dated 2022-06-13 β€” so if you're reading this, hey, it's still serving πŸ’œ mwah, go parse some dates πŸ¦‹β­

πŸ“¦ where this page comes from