Forum Moderators: coopster
$item_details['purchase_date'] ==>> User's good order date.
with this codes,i give the user 3 days to pay the cost. i count 3 days after the order day and show him $sold_auctions_content after this 3 days. i do nothing in this 3 days.
here's the my problem. i would like to count only 3 days in Munday,Tuesday,Wednesday,Thursday and Friday. Not include Saturday and Sunday, also 1st January (and other official holidays). Because,the banks doesnt work these days in my country.
two examples:
1-)
if user order a computer in the Monday, he has 3 days to pay (Tuesday,Wednesday,Thursday).. its ok.
2-)
if user order a computer in the Friday, he has 3 days to pay (these days must be Monday,Tuesday,Wednesday. Not saturday,sunday and monday)
How could i do that with these php codes?
P.S : if someone tell me another way , i can use it with pleasure..
With Best Regards
-----------------------------------------------------------------
$sikecem = date($item_details['purchase_date'] + (03 * 24 * 60 * 60));
$elif = time();
$yarak = $elif > $sikecem;
if ($yarak)
{
$sold_auctions_content ;
}
// Get the Weekday number
$Day = date("w", $item_details['purchase_date']);// Test the day
switch($Day) {
// Sunday (+ 3) = Wednesday
case "0":
// Moday (+ 3) = Thursday
case "1":
// Tuesday (+ 3) = Friday
case "2":
$sikecem = date($item_details['purchase_date'] + (03 * 24 * 60 * 60));// Wednesday (+ 5) = Monday (Thurs, Fri, Mon)
case "3":
// Thursday ( + 5) = Tuesday (Fri, Sat, Sun, Mon, Tue)
case "4":
// Friday (+ 5) = Wednesday (Sat, Sun, Mon, Tue, Wed)
case "5":
$sikecem = date($item_details['purchase_date'] + (05 * 24 * 60 * 60));// Saturday (+ 4) = Wednesday (Sun, Mon, Tue, Wed)
case "6":
$sikecem = date($item_details['purchase_date'] + (04 * 24 * 60 * 60));
}
// Get the Weekday number
$Day = date("w", $item_details['purchase_date']);
// Test the day
switch($Day) {
// Sunday (+ 3) = Wednesday
case "0":
// Monday (+ 3) = Thursday
case "1":
// Tuesday (+ 3) = Friday
case "2":
$sikecem = date($item_details['purchase_date'] + 03 * 24 * 60 * 60);
break;
// Wednesday (+ 5) = Monday (Thurs, Fri, Sat, Sun, Mon)
case "3":
// Thursday ( + 5) = Tuesday (Fri, Sat, Sun, Mon, Tue)
case "4":
// Friday (+ 5) = Wednesday (Sat, Sun, Mon, Tue, Wed)
case "5":
$sikecem = date($item_details['purchase_date'] + 05 * 24 * 60 * 60);
break;
// Saturday (+ 4) = Wednesday (Sun, Mon, Tue, Wed)
case "6":
$sikecem = date($item_details['purchase_date'] + 04 * 24 * 60 * 60);
break;
}