I want to make a countdown in php, but I want it to onlyy work during working hours(8-5), and excluding weekends.
Have no idea how to even start.
Thanks
countdown in php
Moderator: General Moderators
-
bond0bhave
- Forum Newbie
- Posts: 5
- Joined: Wed May 29, 2002 1:55 am
- Location: Durban, South Africa
Ok not sure how to exclude hrs of 8-5. Maybe a portion of the script could check the current time and not display certain functions.
This will get you day(s) left to an event. Are you looking for hour(s) to an event? I can write something quick for that also.
Code: Select all
<?
$day = 1;
$month = 6;
$year = 2003;
print ((int)((mktime (0,0,0,$month,$day,$year) - time(void))/86400) . " day(s) to event.");
?>
Last edited by Kriek on Wed May 29, 2002 8:11 am, edited 1 time in total.
-
bond0bhave
- Forum Newbie
- Posts: 5
- Joined: Wed May 29, 2002 1:55 am
- Location: Durban, South Africa
OK adding the hour(s) is easy.
basicly we add the Variable $hour = 12 into the mix.
Then we output it like this. Notice I just added $event to make it easier.
basicly we add the Variable $hour = 12 into the mix.
Code: Select all
<?
$day = 1;
$month = 6;
$year = 2003;
$hour = 12;
$event = "Till job is done";
$calculation = ((mktime ($hour,0,0,$month,$day,$year) - time(void))/3600);
$hours = (int)$calculation;
$days = (int)($hours/24);
?>Code: Select all
The date is <?=(date ("l dS of F Y h:i:s A"));?>.
It is <?=$days?> days until <?=$event?>.
It is <?=$hours?> hours until <?=$event?>.-
bond0bhave
- Forum Newbie
- Posts: 5
- Joined: Wed May 29, 2002 1:55 am
- Location: Durban, South Africa