Calculation/Comparison on Date

S

sam

Hi,

I m wondering whether there is existing perl module provide functions
for calculating date and comparison of two dates.

I need to take a user input date and will subtract it by 1,3,6 or 12
months. As the requirement only care about YYYY-MM, so I will need to
know the form of starting date and ending date (YYYY-MM-DD) after the
substraction. In this case, the starting date should be in the form of
YYYY-MM-01 and ending date is YYYY-MM-28,29,30 or 31.

Thanks
Sam
 
J

jkeen_via_google

sam said:
Hi,

I m wondering whether there is existing perl module provide functions
for calculating date and comparison of two dates.

I need to take a user input date and will subtract it by 1,3,6 or 12
months. As the requirement only care about YYYY-MM, so I will need to
know the form of starting date and ending date (YYYY-MM-DD) after the
substraction. In this case, the starting date should be in the form of
YYYY-MM-01 and ending date is YYYY-MM-28,29,30 or 31.

CPAN is your friend. See the Date::* and DateTime::* namespaces. My
personal favorite is Date::Calc
(http://cpan.uwinnipeg.ca/module/Date::Calc). For your task, I would
look at the Date::Calc functions whose names begin with Delta_ or
Add_Delta_.

Jim Keenan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top