[Israel.pm] Date manipulations

Gabor Szabo gabor at szabgab.com
Sat Dec 29 23:36:04 PST 2012


On Sun, Dec 30, 2012 at 9:09 AM, Yona Shlomo <yona at cs.technion.ac.il> wrote:
> Hello,
>
> I have date items of the form yyyy-mm-dd and I'd like to be
> able to manipulate them in the following ways:
>
> Given such a date I'd like to ask ordinal questions such as:
> what was the date k days before (e.g., what is the date
> yesterday) or what will be the date n days from that date
> (e.g., what's the date 10 days later).
>
> What's a practical way to go about this?
>
> Thanks.

The "standard" way is using DateTime objects
https://metacpan.org/module/DateTime
but that's a big package. You might get by using
https://metacpan.org/module/DateTime::Tiny

Gabor


More information about the Perl mailing list