note 60076 added to function.mktime

From: Date: Sun, 25 Dec 2005 14:27:10 +0000
Subject: note 60076 added to function.mktime
Groups: php.notes 
Request: Send a blank email to php-notes+get-100680@lists.php.net to get a copy of this message
<? /*************** Take a date from a credit card stored in a mysql database and see when it expires based on today's date. $row[account_exp] = 1/2006 eg. echo "$cc_exp_month/$cc_exp_year ($cc_exp_string)" shows you 1/2006 (7 DAYS) ****************/ list($cc_exp_month,$cc_exp_year) = explode("/", $row[account_exp]); if ( ( $cc_exp_month && $cc_exp_year ) && ( mktime() > mktime(0,0,0,$cc_exp_month,1,$cc_exp_year ) ) ) { $is_expired = TRUE; $cc_exp_string = "<font color=red>".EXPIRED."</font>"; } elseif ( $cc_exp_month && $cc_exp_year ) { $is_expired = FALSE; $time = mktime(0,0,0,$cc_exp_month,1,$cc_exp_year) - mktime(); $time = round($time / (24 * 60 * 60)); $time .= " ".DAYS; $cc_exp_string = "<font color=green>".$time."</font>"; } ---- Manual Page -- http://www.php.net/manual/en/function.mktime.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+60076 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60076&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60076&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60076&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60076&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60076&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60076&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60076&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+60076&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#100680) next »