sql - PHP timestamp time function: 2008 is larger than 2009? -
I do not get this. I want to know that the time of the database is before or after the present time, so I have written it:
$ qVraagCodeOp = "SELECT * FROM` code` WHERE 'codecod = '$ Value' "; $ RVraagCodeOp = mysql_query ($ qVraagCodeOp); $ AVraagCodeOp = mysql_fetch_assoc ($ rVraagCodeOp); $ Old time = mktime ($ aVraagCodeOp ["Code_Expdate"]); $ Abatement = time (); Echo "database time = $ aVraagCodeOp [Code_Expdate]
"; Echo "mktime =" $ longtime "
"; Echo "is now timestamp = $ abatement
; The echo is 'today:'. Date ('Y-M-D', $ Auburn). "& Lt; br / & gt;"; Echo "new loan old =" ($ now time - $ old time);
Because the database says that the date is somewhere in 2008 and the current date is in 2009, the result of subtraction should be positive. However, this output is:
database timing = 2008-12-01 mktime = 1263136596 timestamp now = 1255907796 today: 2009-10-19 new loan old = -7228800
Does anyone understand this? Am I doing something wrong?
Try changing it $ oldTime = mktime ($ aVraagCodeOp ["Code_Expdate"]) ;
this $ oldTime = strtotime ($ aVraagCodeOp ["Code_Expdate"]);
Comments
Post a Comment