php - Issue with strtotime() and setting timezone -


i how use strtotime, first need set timezone, causing issue:

$date = new datetime(); $date->settimezone(new datetimezone('america/new_york')); $idate = $date->format('y-m-d h:i:s');  $fdate=strtotime($idate,"+2 hours");  

$idate comes out fine, in correct timezone, in format: 2016-07-25 15:56:24

how can add 2 hours onto , return variable in same format?

try this:

$fdate=date('y-m-d h:i:s',strtotime($idate."+2 hours"));  

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -