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

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

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -