php - Compare given date with today -


i have following

$var = "2010-01-21 00:00:00.0" 

i'd compare date against today's date (i.e. i'd know if $var before today or equals today or not)

what function need use?

strtotime($var); 

turns time value

time() - strtotime($var); 

gives seconds since $var

if((time()-(60*60*24)) < strtotime($var)) 

will check if $var has been within last day.


Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -