Posted By

Smolla on 07/23/10


Tagged

date compare


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

osirisinternet


Compare dates


 / Published in: PHP
 

  1. $first_date = implode('-', array_reverse(explode(".", '01.02.2001')));
  2. $second_date = implode('-', array_reverse(explode(".", '31.01.2001')));
  3.  
  4. print 'The '.($first_date < $second_date ? 'first' : 'second').' date is the older.';

Report this snippet  

You need to login to post a comment.