in reply to Adding to dates

Over the years I have used Date::Manip as GrandFather has already suggested, currently much of my code uses Time::Piece. Others may suggest DateTime, all of these work well and each has its own advantages. If you are doing lots of commercial type calculations then Date::Calc may be what you need. Date::Manip is by far the heavy lifting champion offering far more than any of the others. But it is BIG, and by the authors own admission, slow. In fact he suggests you probably shouldn't be using it, but yu need to read the doc's just to be certain.

jdtoronto

Replies are listed 'Best First'.
Re^2: Adding to dates
by Anonymous Monk on Aug 23, 2006 at 05:19 UTC
    Thank you! That worked. Here is what I did:
    # $_bill is set as a fetchrow_hashref from the mysql db. ($_billUser_month,$_billUser_day,$_billUser_Year) = split /\//, $_bill +->{orig_day}, 3; $_add_Months = $_bill->{months_active} + 1; ($_billUser_Year,$_billUser_month,$_billUser_day) = Add_Delta_YM($ +_billUser_Year,$_billUser_month,$_billUser_day, 0,$_add_Months); ($_billUser_Year,$_billUser_month,$_billUser_day) = Add_Delta_Days($_b +illUser_Year,$_billUser_month,$_billUser_day, -5); $_nextBillingDate = sprintf("%02d/%02d/%02d",$_billUser_month,$_billUs +er_day,$_billUser_Year); $dbh->do(qq{UPDATE `subscription_users` SET `day` = ?, months_active = + months_active + 1 WHERE `id` = ?}, undef, $_nextBillingDate, $_billU +ser_id);
    That way I am always basing the billing day off the original month. That way the billing DAY don't ever change, like going from 31 one month, to 30 then it would stay 30 because the next date is based on 30... Anyhow, thank you so much!!


    Thanks again!
    RJEnterprises