php - Date diffirence between now date and the data add date -
i need create date diffirence if token had +1 day of beingness added database expires , problem don't know how calculate date diffirence beetween date of token adding , "now" date check if it's expired or not. heard date_diff .. idk how utilize it. suggestions please?
for accurate need can compare 2 dates.
in php$now = new datetime("now"); $now->modify("-1day"); $yourtokendate = new datetime($datefromedatabase); if($yourtokendate > $now){ echo "ok"; }else{ echo "expired"; } in sql select yourtocken yourtable tocken_date > datesub("1day",now()) php mysql
No comments:
Post a Comment