Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dates for Days...

Status
Not open for further replies.

dodgyone

Technical User
Jan 26, 2001
431
GB
I'm trying to build a page which lists...

The days in the present working weekday with the date (dd/mm/yy format) alongside. For example:

Monday - 10/10/02
Tuesday - 11/10/02
etc etc etc ...
Friday - 14/10/02

And then the dates for the following week etc etc.

Does anybody have any suggestions about how to do this. In ASP it just seemed so much easier!!!!!

Many thanks...
 
You may find some interesting date stuff here : thread434-251469 ***************************************
Party on, dudes!
[cannon]
 
I don't think that's really what i'm after thanks KarveR.

Could somebody please make me up an example and short explanation to work by?

Cheers....
 
I'm really not sure about how to use the mktime function.

I need to establish which day of the week it is today and then what the date was/is for Monday to Friday in that week. And also the dates for Monday to Friday for the following week. The help docuemnt on PHP.net seems to be really poor!

Does anyone have a simple explanation to show how this can be achieved....

Thanks
 
<?php



$month = date(&quot;m&quot;);
$day = date(&quot;d&quot;);
$year = date(&quot;Y&quot;);

echo &quot;Today is $day $month $year<hr>&quot;;

echo &quot;last Monday: &quot;.date(&quot;d m Y&quot;, mktime(0,0,0,$month,$day+1-date(&quot;w&quot;,mktime(0,0,0,$month,$day,$year)),$year)).&quot;<br>&quot;;
echo &quot;next Friday: &quot;.date(&quot;d m Y&quot;, mktime(0,0,0,$month,$day+5-date(&quot;w&quot;,mktime(0,0,0,$month,$day,$year)),$year)).&quot;<br>&quot;;
echo &quot;<hr>&quot;;

echo &quot;Next week:<br>&quot;;
echo &quot;Monday is : &quot;.date(&quot;d m Y&quot;, mktime(0,0,0,$month,$day+8-date(&quot;w&quot;,mktime(0,0,0,$month,$day,$year)),$year)).&quot;<br>&quot;;
echo &quot;Friday is : &quot;.date(&quot;d m Y&quot;, mktime(0,0,0,$month,$day+12-date(&quot;w&quot;,mktime(0,0,0,$month,$day,$year)),$year)).&quot;<br>&quot;;

?> ***************************************
Party on, dudes!
[cannon]
 
By the way if you do date(&quot;d/m/Y&quot;,

your dat will be in dd/mm/yyyy format. ***************************************
Party on, dudes!
[cannon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top