Page 1 of 1

Simple Date Expiration

Posted: Mon Oct 02, 2006 10:00 am
by protasov
For some reason I seem to be having trouble getting the right method to use for my problem...basically, I want to use an expiration date. For example, when a user tries to perform a button click, the system checks the date/time, and if its past a certain date/time, not allow it to continue, accurate to the second.

So I have a web page that allows for a login...if they attempt to login after Oct. 8 2006 1:00pm EST, then it won't let them....

Should be simple, but I can't seem to get it.

Any help is greatly appreciated....


Posted: Mon Oct 02, 2006 10:07 am
by volka

Code: Select all

<?php
$ts = strtotime('Oct. 8 2006 1:00pm EST');
if (time() > $ts) {
	die ('login not allowed after '. date('d.m.Y H:i:s', $ts));
}
?>
see http://de2.php.net/strtotime

Posted: Mon Oct 02, 2006 10:08 am
by hanji
Do you have any code to show? I think you'll want to look at mktime()

Thanks
hanji

Posted: Mon Oct 02, 2006 10:10 am
by hanji
volka wrote:

Code: Select all

<?php
$ts = strtotime('Oct. 8 2006 1:00pm EST');
if (time() > $ts) {
	die ('login not allowed after '. date('d.m.Y H:i:s', $ts));
}
?>
see http://de2.php.net/strtotime

I like that!
hanji