Page 1 of 1
countdown in php
Posted: Wed May 29, 2002 3:26 am
by bond0bhave
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
Posted: Wed May 29, 2002 3:46 am
by Kriek
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.
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.");
?>
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.
Posted: Wed May 29, 2002 6:37 am
by bond0bhave
thanks
I need it to countdown in hours how much time left a person has from the time a job was started.
Will play around witht that one though
Posted: Wed May 29, 2002 8:05 am
by Kriek
OK adding the hour(s) is easy.
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);
?>
Then we output it like this. Notice I just added $event to make it easier.
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?>.
Posted: Wed May 29, 2002 9:11 am
by bond0bhave
thanks, that really helps, will give it a bash