Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@reneeb
Created August 25, 2021 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reneeb/64850a3c2dc8f6b0f8d26747760b7b6f to your computer and use it in GitHub Desktop.
Save reneeb/64850a3c2dc8f6b0f8d26747760b7b6f to your computer and use it in GitHub Desktop.
reneeb@host:~$ perl -MDateTime -E 'my $month; my $date = DateTime->new(day=> 7, month=>11, year=>2021); $date->month() < 10 ? $month = $date->month() : $month = "0" . $date->month(); say $month'
011
reneeb@host:~$ perl -MDateTime -E 'my $month; my $date = DateTime->new(day=> 7, month=>8, year=>2021); $date->month() < 10 ? $month = $date->month() : $month = "0" . $date->month(); say $month'
08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment