Page 1 of 1

php date settings

Posted: Wed Oct 01, 2008 4:21 am
by booney1983
Dear friends,
İ've got an shopping site and have some problems with these codes, Here's the a part of my codes mean;
$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
-----------------------------------------------------------------
Here's my codes

$ahmet = date($item_details['purchase_date'] + (03 * 24 * 60 * 60));
$elif = time();
$necati = $elif > $ahmet;
if ($necati)
{
$sold_auctions_content ;
}

Re: php date settings

Posted: Wed Oct 01, 2008 5:16 am
by vishal.angre
you need to write customoized code as you required.. i can give you the code for only saturday and sunday. But dont know about your official holidays..

like


$actual_date = $item_details['purchase_date'];
$i = 0;
while ($i <= 3)
{
$due_date = $actual_date + (24 *60* 60);
if ((date('N', $due_date) != 1) && (date('N', $due_date) != 7))
{
$i++;
$actual_date = $due_date;
}
}
echo "This is actual due date == " . date('d-m-Y', $actual_date);

You can find actual date...