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

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -