time checking

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

time checking

Post by itsmani1 »

Hello

I want to check if time is beween 28th august 2007 12:12:12 and 28th august 2007 12:18:12

any help
thanks
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

strtotime is your friend

Code: Select all

<?php
$s = strtotime('28th august 2007 12:12:12');
$e = strtotime('28th august 2007 12:18:12');

$now = time();

if ( $now>=$s && $now<=$e ) {
	echo '+';
}
else {
	echo '-';
}
Post Reply