Hello,
I have this:
Mon, Tue, Wed, Thu, Fri, Sat, Sun created as links. What I would like to
do is to associate days with its current week dates, for example:
Mon (05.01.2004); Tue (06.01.2004); and so on.
TNX 6 11152
"dr. zoidberg" <so*****@14.u7.da.ru> wrote in message news:<G7*****************@ns45.bih.net.ba>... Hello,
I have this:
Mon, Tue, Wed, Thu, Fri, Sat, Sun created as links. What I would like to do is to associate days with its current week dates, for example:
Mon (05.01.2004); Tue (06.01.2004); and so on.
TNX
I'm not quite sure what you're trying to accomplish, but you could
always use the date() function.
mjacob wrote: "dr. zoidberg" <so*****@14.u7.da.ru>
Hello,
I have this:
Mon, Tue, Wed, Thu, Fri, Sat, Sun created as links. What I would like to do is to associate days with its current week dates, for example:
Mon (05.01.2004); Tue (06.01.2004); and so on.
TNX
I'm not quite sure what you're trying to accomplish, but you could always use the date() function.
I'm trying do display weekdays with dates, monday to sunday, but only
for current week, something like small calendar.
dr. zoidberg wrote: I'm trying do display weekdays with dates, monday to sunday, but only for current week, something like small calendar.
<?php
$wd_arr = array('Mo ', 'Tu ', 'We ', 'Th ', 'Fr ', 'Sa ', 'Su ');
$monday = mktime(0, 0, 0, // hour, minute, second
(int)date('m'), // month
(int)date('d')+(1-(int)date('w')), // day (can be negative!)
(int)date('Y')); // year
for ($n=0; $n<7; $n++) {
echo $wd_arr[$n], date('Y-m-d', $monday+$n*60*60*24), "<br/>\n";
}
?>
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
dr. zoidberg schrieb: mjacob wrote:
"dr. zoidberg" <so*****@14.u7.da.ru>
Hello,
I have this:
Mon, Tue, Wed, Thu, Fri, Sat, Sun created as links. What I would like to do is to associate days with its current week dates, for example:
Mon (05.01.2004); Tue (06.01.2004); and so on.
TNX I'm not quite sure what you're trying to accomplish, but you could always use the date() function.
I'm trying do display weekdays with dates, monday to sunday, but only for current week, something like small calendar.
Hi mjacob,
i hope this code snippet will help you. I just wrote it down in this
mail, maybe some things do not work instantly but it should at least
show you the way:
// CODE START
switch($weekday) // $weekday should contain "Sun" or "Mon" and so on
{
case "Sun":
$weekdaynr = 0; // assign a nr representing the weekday
break;
case "Mon":
$weekdaynr = 1;
break;
// ... and so on ...
}
$todaynr = date("w"); // assign the today weekday
$day_diff = $todaynr - $weekdaynr; // get the difference in days
$sec_diff = $daydiff * 24 * 60 * 60; // get the difference in seconds
$target_date = mktime() - $sec_diff; // actual timestamp - difference
echo date ("D (d.M.Y)", $target_date); // output newly formatted date
// CODE END
you can also use strftime() for more format options
Have a nice day,
Chris
On Wed, 07 Jan 2004 16:16:35 +0100, dr. zoidberg wrote: I'm trying do display weekdays with dates, monday to sunday, but only for current week, something like small calendar.
DZ..
Check out <http://www.phpbuilder.com/> and do a quick search / hunt for a
calendar app / code on there. One does exist.
Pre-warning... the code doesn't work 100% as it's entered on the site.. I
tried to use it a while back but broke horrible, however, it does have the
data / "formula" for displaying dates relative to days (including "empty
ones".. ie: it knows the start day of the month and the end day for
example) and might help you on your way to what you're aiming for =)
HTH.
Regards,
Ian
--
Ian.H [Design & Development]
digiServ Network - Web solutions www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.
Pedro Graca wrote: dr. zoidberg wrote:
I'm trying do display weekdays with dates, monday to sunday, but only for current week, something like small calendar.
<?php $wd_arr = array('Mo ', 'Tu ', 'We ', 'Th ', 'Fr ', 'Sa ', 'Su '); $monday = mktime(0, 0, 0, // hour, minute, second (int)date('m'), // month (int)date('d')+(1-(int)date('w')), // day (can be negative!) (int)date('Y')); // year
for ($n=0; $n<7; $n++) { echo $wd_arr[$n], date('Y-m-d', $monday+$n*60*60*24), "<br/>\n"; } ?>
Great script.
Few adjustment and I created what I want. TNX This discussion thread is closed Replies have been disabled for this discussion. Similar topics
5 posts
views
Thread by BlackFireNova |
last post: by
|
5 posts
views
Thread by Alicia |
last post: by
|
1 post
views
Thread by Liz Malcolm |
last post: by
|
1 post
views
Thread by rock72 |
last post: by
|
3 posts
views
Thread by haydn_llewellyn |
last post: by
|
3 posts
views
Thread by Jon |
last post: by
| |
6 posts
views
Thread by Jana |
last post: by
|
3 posts
views
Thread by Bob Sanderson |
last post: by
| | | | | | | | | | |