You are here: Date/time format for comparison of string to NOW « All PHP « IT news, forums, messages
Date/time format for comparison of string to NOW

Posted by Pupkin on 10/07/06 00:13

Hi,

I need to set some content to only show after a given date and time.

Like:

<?
$livedate = "October 06 2006 17:45";
if (date("r") > $livedate) { ?>
Content here
<? } ?>


I'm used to ASP, where I've gotten into trouble by not forcing my text
string date/time into the datetime format, so the if-then statement was
not comparing like-to-like (and several days or hours later, when a
single digit element changed to two-digits, the code would return
unintended results).

Is this something I need to worry about with PHP?

I've tried some experiments force-formatting my text string date/time
with date($livedate), mktime(livedate), etc., but I never end up with
anything that resembles the date("r").

What do I need to learn to get this to work with reliable results?

Thanks.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация