Add 5 minutes to current time in php
I want to add 5 minutes to this date: Show
When I use How do I add correctly 5 minutes to
Script47 13.8k4 gold badges43 silver badges61 bronze badges asked Apr 10, 2011 at 0:42
2
Now, the result is 2011-04-08 08:34:49 and is stored inside Enjoy! :) answered Apr 10, 2011 at 0:46
FrantisekFrantisek 7,23515 gold badges56 silver badges99 bronze badges Try this:
Alix Axel 148k91 gold badges390 silver badges493 bronze badges answered Apr 10, 2011 at 0:46
BlenderBlender 279k51 gold badges424 silver badges487 bronze badges
Results in: 2012-09-30 09:00:03 2012-09-30 09:05:03 answered Sep 30, 2012 at 14:02
0 For adding
answered Mar 25, 2014 at 16:44
NidhinNidhin 1,80822 silver badges22 bronze badges 1 If i'm right in thinking. If you convert your date to a unix timestamp via strtotime(), then just add 300 (5min * 60 seconds) to that number.
Hope this helps answered Apr 10, 2011 at 0:50
studioromeostudioromeo 1,56312 silver badges18 bronze badges
answered Apr 1, 2014 at 10:01
MaxEchoMaxEcho 14.1k6 gold badges78 silver badges88 bronze badges more illustrative for simple and clear solution
answered Aug 28, 2015 at 15:30
DeveloperDeveloper 3,6674 gold badges36 silver badges45 bronze badges How to add 5 minutes to timestamp in php?Example 1: PHP Add Minutes to Time. index.php. $date = "10:10:05"; $newDate = date('H:i:s', strtotime($date. ' +10 minutes')); ... . Output: 10:20:05.. index.php. $newDate = date('H:i:s', strtotime('+10 minutes')); echo $newDate; ?>. Output: Read Also: PHP Add Hours to Datetime Example. 04:05:51. i hope it can help you.... How to add minutes to timestamp in php?You could use strtotime() like this: $date = date('Y-m-d H:i:s', strtotime('now +60 minutes'));
How can I add minutes and minutes in PHP?For this, you can use the strtotime() method. $anyVariableName= strtotime('anyDateValue + X minute'); You can put the integer value in place of X.
How to add hours and minutes to time in php?PHP | DateTime add() Function
The DateTime::add() function is an inbuilt function in PHP which is used to add an amount of time (days, months, years, hours, minutes and seconds) to the given DateTime object.
|