Evening All
I have an intriguing problem involving date calculation. For the record, i have no problem building OO php, but for some reason this tiny function is sending me round in circles.
The basic premise is to calculate the time left until friday 6pm in days, hours, mins and seconds when the user loads a page (i.e. how long is left until the weekend). This should be done by getting the current time from the server, and comparing it to a generated timestamp for the nearest friday. For example, if the page is loaded on wednesday at 1pm, the function needs to find out when the next friday is and build a timestamp for 6pm on that date. The two dates then need to be compared/subtracted to or from one another and formatted appropriately.
I want to evolve it to then detect if the page is loaded on the weekend and calculate the time left to the end (11.59pm sunday).
The idea afterwards (i've already built this) is to take the resulting string and pump out a dynamic PNG graphic which is included in the header of every page on a site as a countdown.
Can anyone shed any light on this or help me?
Cheers
Alex