1

i'am still beginner in php. i have problem to get right time when using date_default_timezone_set(). so i try gmdate but i don't know how to add hours when get time using gmdate. is there anyone know how to add hours or change GMT to GMT+7 in PHP? please and thank you

mrenaldi
  • 11
  • 2
  • 1
    The easiest way to handle dates is almost always to use PHP's `DateTime` class. Never add or subtract hours. Just change the timezone. See: https://stackoverflow.com/questions/15625834/how-to-convert-between-time-zones-in-php-using-the-datetime-class/15626078#15626078. – Mike Jun 20 '18 at 02:20
  • thank you, i will try it now. – mrenaldi Jun 20 '18 at 03:33

0 Answers0