FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » comparing dates?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: comparing dates? [message #175487 is a reply to message #175485] Sun, 02 October 2011 13:43 Go to previous messageGo to previous message
houghi is currently offline  houghi
Messages: 45
Registered: September 2011
Karma:
Member
Michael Joel wrote:
> Is there a better way to compare dates than breaking a date into day,
> month, year and comparing each part?
> I need to know if a date (say 10/03/2011) is before another date in
> the same format. Direct comparison doesn't work.

strtotime, but mind the layout of your date. For me the above would be
tenth of march, for others it may be october 3rd.

<?php
echo strtotime("10/03/2011"), "\n";
?>

That should be easy enough to make comparisons
http://php.net/manual/en/function.strtotime.php

houghi
--
How do you ask a man to be the last man to die in Iraq?
How do you ask a man to be the last man to die for a mistake?
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: simple image in PHP
Next Topic: Question about new lines
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 21:28:43 GMT 2024

Total time taken to generate the page: 0.04235 seconds