Checking credit card expiration : mktime « Date « PHP






Checking credit card expiration

 
<?php

$expires = mktime(0, 0, 0, $_POST['month'], 1, $_POST['year']);

$nextMonth = mktime(0, 0, 0, date('n') + 1, 1);
if ($expires < $nextMonth) {
   print "Sorry, that credit card expires too soon.";
}
?>
  
  








Related examples in the same category

1.Calculating the difference between two dates
2.Creating a Timestamp with mktime()
3.Use mktime to create a time
4.Using mktime() and date()
5.int mktime ( [int hour [, int minute [, int second [, int month[, int day [, int year [, int is_dst]]]]]]] )
6.mktime() produces a GMT timestamp.
7.mktime.php
8.Making an epoch timestamp
9.Get the labor day