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 i开发者_如何学Gos 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
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.
Reason: Maybe the internal time of your MySQL server is not synchronized properly.
Solution: Ask your webhost / server-admin to correctly synchronize the time.
Minutes is 'i' for date() function. Try date('H:i', strtotime($value));
精彩评论