[Israel.pm] Date manipulations

Meir Guttman meir at guttman.co.il
Sun Dec 30 01:44:41 PST 2012

A somewhat small addition:

Although Date::Calc is specified in scalars for the year, month and day, it
is easier to work using an @array  for the date where:

	$array[0] = $year;
	$array[1] = $month; 
	$array[2] = $day;

	use strict;
	use warnings;
	use Date::Calc;

	my @array = split "-'", $date_string;
	my $in_ten_days_it_will_be = Add_Delta_Days(@array, 10);

Happy dates manipulation!


-----Original Message-----
From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On Behalf
Of Yona Shlomo
Sent: יום א 30 דצמבר 2012 09:09
To: perl at perl.org.il
Subject: [Israel.pm] Date manipulations


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?


Shlomo Yona
yona at cs.technion.ac.il
Perl mailing list
Perl at perl.org.il

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2637/5496 - Release Date: 12/29/12

More information about the Perl mailing list