I have this 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?
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?