[Israel.pm] Date manipulations
Yona Shlomo
yona at cs.technion.ac.il
Mon Dec 31 05:50:04 PST 2012
On Sun, 30 Dec 2012, Assaf Gordon wrote:
> Sometimes old ways are the simplest (even if not pure Perl):
>
> $ date -d "2012-12-30 12pm + 10 days"
> Wed Jan 9 12:00:00 EST 2013
> $ date -d "2012-12-30 12pm - 10 days"
> Thu Dec 20 12:00:00 EST 2012
>
> To print just the date:
> $ date -d "2012-12-30 12pm + 10 days" +%F
> 2013-01-09
>
> Or just the day:
> $ date -d "2012-12-30 12pm + 10 days" +%A
> Wednesday
>
> The "12pm" is there to avoid leap-day related surprises.
That's acutally quite useful.
--
Shlomo Yona
yona at cs.technion.ac.il
http://yeda.cs.technion.ac.il/~yona/
More information about the Perl
mailing list