views:

25

answers:

2

Hi guys, I'm taking a string which represents a time value and am storing it in a database table where the field type is also a time value. The problem is that I try to first format the string to be of a date time format using the code:

date('H:m', strtotime($value));

The issue is that its returning the time but with 8 minutes incremented to it.. I have no idea why is this happening. Im using php MySQL. Help please

+1  A: 

Reason: Maybe the internal time of your MySQL server is not synchronized properly.

Solution: Ask your webhost / server-admin to correctly synchronize the time.

shamittomar
A: 

Doesn't the database need it to be in HH:MM:SS (H:i:s) format for a TIME field?

Maybe it is taking HH:MM and trying to fit it into the wrong shaped field.

Dai
Ouch! I just notcied I'm formatting it wrong! 'i' represents minutes and not 'm'.. thanks for pointing it out!
Ali
lol, I didn't see that either so...
Dai