|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
PHP5 - Need help with adding 30 minutes
Hi,
I have a time, i.e. 9.30, and I want to add 30 minutes. This is the method I have constructed: PHP Code:
$time_end should output 10-00 and it does. But if the start time is different, like 11.00 then $time_end should be 11.30, but it's not, it outputs 11.00 as no calculation was done. Can anyone point out what I'm doing wrong? |
|
#2
|
|||
|
|||
|
s is seconds
if you do this instead PHP Code:
you'll see where the problem is. i is minutes with the leading zeros Quote:
|
|
#3
|
||||
|
||||
|
when you call date() your format string is telling it to only display hours and seconds. So the 30 minutes is never shown. So just change the format string:
PHP Code:
__________________
. Web Dev Cheat Sheets :: Flash 8 LiveDocs :: PHP Manual :: MySQL Manual :: My Zodiac/13Moon Mod for SMF :: Compare Game Prices "All matter is merely energy condensed to a slow vibration. We are all one consciousness experiencing itself - subjectively. There is no such thing as death, life is only a dream. We are the imaginations of ourselves." - Bill Hicks "Truth is hidden in the subtle nature of the heart of everything, although it is invisible. One cannot see it from inside and neither from the surface. One can only live and experience it." - Heart Sutra |
|
#4
|
|||
|
|||
|
I feel so stupid. I even double checked to make sure I had the correct format string and I still missed it.
Thanks for pointing out the error. I'll go in shame and hide in a hole ![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > PHP Development > PHP5 - Need help with adding 30 minutes |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|