473,398 Members | 2,427 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

php date settings

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

[PHP]$ahmet = date($item_details['purchase_date'] + (03 * 24 * 60 * 60));
$elif = time();
$necati = $elif > $ahmet;
if ($necati)
{
$sold_auctions_content ;
}[/PHP]
Oct 1 '08 #1
1 1588
There's no single function in PHP that can do this. But using the date function you could get this working. See: http://www.php.net/date

Using the 'N' format you can get the day of the week in the form 1..7. So a simple if excluding 6 and 7 would discard weekends. As far as holidays go you'll probably have to check each one manually. I suggest storing all of your recognized holidays in an array and loop through and compare for each day.

So write a loop that will go one day at a time from the order date, use date with 'N' to see if it is a weekend, if so skip it. Use your array to see if it is a holiday, if so skip. If both pass increment a counter. Go the the next day and repeat until your counter is 3, then you have the date 3 business days later.

Hope that makes sense.
Oct 10 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: androtech | last post by:
Hello, I'm looking for a function that returns a date range for a specified week number of the year. I'm not able to find functions like this anywhere. Any pointers/help would be much...
15
by: Simon Brooke | last post by:
I'm investigating a bug a customer has reported in our database abstraction layer, and it's making me very unhappy. Brief summary: I have a database abstraction layer which is intended to...
1
by: Laurence Neville | last post by:
This is regarding a change in the Short Date format under Hebrew Regional Settings, that has caused huge problems in our ASP web application. The change appears to have been introduced sometime...
2
by: Franck | last post by:
Hi, 'm gettin mad about date conversion. Here is the point. Got and add-in for Excel which call functions from a web service (on a remote server) The remote server has regional settings...
0
by: Harold Crump | last post by:
Greetings, I am using SQL Server for state management in an ASP.NET application. The ASPStateTempSessions table is being stored in the ASPState table (and not the SQL Temp database). I am...
9
by: Schfooge | last post by:
I am trying to do a homework assignment, but I am having troubles due to regional date settings. Part of the program requires a date to be read from a sequential file, which gives the date in...
15
by: Khurram | last post by:
I have a problem while inserting time value in the datetime Field. I want to Insert only time value in this format (08:15:39) into the SQL Date time Field. I tried to many ways, I can extract...
7
by: Fred Flintstone | last post by:
I'm writing a VB.Net windows forms application. This line of code: Personal.EffectiveDate = GridRow2.Cells("New Value").Value.ToString.Trim Fails with this error: Cast from string...
2
by: tricard | last post by:
Good morning, I am writing code to create a packing list number that is based on the date entered from the workstation that the user is on. However, I do not know how to determine the date...
20
by: keri | last post by:
Hi, I am creating a table where I want to use the date as the primary key - and to automatically create a record for each working date (eg Mon to Fri) until 30 June 2007. Is this possible? I do...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.