in reply to Re: Yesterday's date
in thread Yesterday's date
G'day hippo,
++ I agree with your approach; particularly in light of the OP's "I am not concerned about daylight savings time, time zone nor do I need HMS.".
Having said that, I believe use of the ONE_DAY constant from Time::Seconds (also a core module) would add clarity.
It's the same value:
$ perl -E 'use Time::Seconds; say ONE_DAY' 86400
It works as a direct replacement in your code:
$ perl -e ' use strict; use warnings; use Time::Piece; use Time::Seconds; my $t = Time::Piece->strptime($ARGV[0], "%d/%m/%Y"); printf "Date as supplied: %s\n", $t->dmy("/"); $t = $t - ONE_DAY; printf "Date minus one day: %s\n", $t->dmy("/"); ' 01/12/2022 Date as supplied: 01/12/2022 Date minus one day: 30/11/2022
— Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Yesterday's date
by parv (Parson) on May 29, 2023 at 20:12 UTC | |
by kcott (Archbishop) on May 30, 2023 at 07:48 UTC |