PHP Code:if ($current_time <= $max_time && $current_time >= $min_time) {
//if between the min and max times
} else {
// not in between min and max times.
}
Printable View
PHP Code:if ($current_time <= $max_time && $current_time >= $min_time) {
//if between the min and max times
} else {
// not in between min and max times.
}
One last question.
How do i define current time and max and min time.
strtotime is the lazy man's way to make times, and it usually works. For example, a timestamp out of MySQL using DATETIME or TIMESTAMP data-types will work in strtotime with high probability of reliability.PHP Code:$max_time = strtotime('tomorrow');
$current_time = strtotime('today');
$min_time = strtotime('yesterday');
another one
PHP Code:$max_time = strtotime('-1 hour'); // 1 hour ago
$current_time = strtotime('2 hours ago'); // 2 hours ago
$min_time = strtotime('180 minutes ago'); // 180m / 60m = 3h ago
so i want a code to be showd from 2AM and another one from 2PM.How do i use that?
This should be done with javascript, not PHP. If you must use server time, you can spit it out somewhere and have the javascript read it and use it as the time instead of the client's time.
I think hes refering to something like the cheech and chong countdown time with huge letters and slowly counting down second by second.
Have you tried putting '2PM' and '2AM' in strtotime?
Result:PHP Code:echo date('r', strtotime('2AM')) . "\n" . date('r', strtotime('2PM'));
Come on, it's easy :) Don't be afraid to try things- I promise PHP won't blow up your host if you make a mistake...Code:Wed, 18 Apr 2012 02:00:00
Wed, 18 Apr 2012 14:00:00
JavaScript would truly be the better way to format/display the date. You should only use PHP to send your time strings to JavaScript if they're stored server-side.
For example, the PHP date function I used in this post is completely useless if you're coding PHP right.
ok thank you all for the replyes.
I found a java script that does half the job.
Anyone who is willing to help me with this please look here
http://forum.ragezone.com/f144/help-...ntdown-837442/
Thanks again for the great support untill now.
I'm searching for server sided not client sided.