-2

I want to add a specific period like 2 hours to only time.
BUT only TIME. There will be no date related issue.

Like my time is 02:00:00
And I want to add 1 hour to this time.
So, the result will be 03:00:00

Is there any PHP built-in function like strtotime()?
I don't want explode related function for this like explode(":", $time)

Is it possible? Please help someone.

Teenager
  • 23
  • 6
  • 1
    https://stackoverflow.com/questions/20557059/php-adding-15-minutes-to-time-value#20557225 Protip: 1 hour is 60 minutes. With all due respect, but questions like yours have been answered correctly and upvoted to 100 at least 500 times by now. Next time do a little more research. – Loek Jul 02 '18 at 14:08

1 Answers1

0

Try

$new_time = date("H:i:s", strtotime("+ 1 hours"))

or if you would just like the timestamp:

strtotime("+ 1 hours")

RookieSA
  • 101
  • 8