php - How to store expiration time? -
i want store expiration time in database. using below code store expiration time +1 year.
$cdate = time(); $date = $cdate + 365*24*60*60; $date = date("y-m-d h:i:s",$date); but not storing correct time stores 2014-08-10 07:55:14 time on storing 2014-08-10 01:25:14. aslo not sure or pm .
thanks.
time/date functions in php using timezones determine local time. if server in timezone gmt+6 means date() function return date/time 6 hours before gmt.
you can check date_default_timezone_set() function manual find out how php selecting timezone.
to set timezone, can use date_default_timezone_set() before calling date function or can set php.ini setting date.timezone timezone.
for second part of question - when formatting time using date() function h format character return 24-hour format of hour leading zeros.
Comments
Post a Comment