Using PHP's mktime() on fixed date -
so understand how use mktime()
create date based on current date/time:
date("y-m-d h:i:s", mktime(date("h"), date("i"), date("s"), date("m"), date("d"), date("y")+1
this creates date 1 year now.
but how if wanted find out date 1 year ahead of fixed date? e.g. date 1 year in future of date 2017-10-01 23:59:59
you should use datetime class. nevertheless, answer question:
$time = strtotime('27-07-2017'); $date = date( 'y-m-d h:i:s', mktime( date('h', $time), date('i', $time), date('s', $time), date('m', $time), date('d', $time), date('y', $time)+1 ) );
Comments
Post a Comment