Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

GT::Date and getting the same day of week

Quote Reply
GT::Date and getting the same day of week
I have this code:

Code:


// Today's Date, e.g. Monday

GT::Date::date_set_format('%mmmm% %dd%, %yyyy%');
my $current_date = GT::Date::date_get(); // today's date



// Monday 2 weeks from this Monday
GT::Date::date_set_format('%mmmm% %dd%, %yyyy%');
my $update_date = GT::Date::date_add($current_date, 14);



print $update_date;


The problem is I want to always return the date that is on the SAME day of the week 2 weeks from this day. So if it's Monday Nov 10, the next one is Monday, Nov 24.

The problem is that adding 14 days is NOT accurate as the returned date seems to be off by 1 day sometimes (i.e. sometimes adding 14 days works sometimes you need to add 15 days).

Anybody know if this is due to the fact that some months have 31 days, if so is there a consistent way to get the same day 2 weeks from the current day of the week as a GT:: Date construct?
Subject Author Views Date
Thread GT::Date and getting the same day of week scorpioncapital 1853 Nov 3, 2003, 10:18 AM
Thread Re: [scorpioncapital] GT::Date and getting the same day of week
Andy 1795 Nov 3, 2003, 10:44 AM
Post Re: [Andy] GT::Date and getting the same day of week
scorpioncapital 1796 Nov 3, 2003, 11:03 AM