database field with type timestamp is not updating
Duplicate of database timestamp value is not updating
I have a variable which contains the date and time in 0000-00-00 00:00:00 format but when i put this variable in database field with type timestamp .. i开发者_Go百科t is still 0000-00-00 00:00:00
Make sure that you are using the right format of the datetime. Mysql default datetime format is YYYY-MM-DD H:i:s. But, it seems that you are trying to insert the datetime value with the format of (YYYY:MM-DD H:i:s). It does not allow to insert the datetime value, so the inserted value becomes 0000-00-00 00:00:00.
Try by changing your calendar format to (YYYY-MM-DD H:i:s). I assume that you are using datatime datatype for the Valid_till column. Click the below to know more about mysql data structure.
Mysql Date format
精彩评论