close

[Solved] Invalid datetime format: 1292 Incorrect datetime value

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Invalid datetime format: 1292 Incorrect datetime value in php. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Invalid datetime format: 1292 Incorrect datetime value Error Occurs?

Today I get the following error Invalid datetime format: 1292 Incorrect datetime value in php.

How To Solve Invalid datetime format: 1292 Incorrect datetime value Error ?

  1. How To Solve Invalid datetime format: 1292 Incorrect datetime value Error ?

    To Solve Invalid datetime format: 1292 Incorrect datetime value Error You need to format date like "Y-m-d H:i:s" in order to work with MySQL datetime field.

  2. Invalid datetime format: 1292 Incorrect datetime value

    To Solve Invalid datetime format: 1292 Incorrect datetime value Error You need to format date like "Y-m-d H:i:s" in order to work with MySQL datetime field.

Solution 1

You need to format date like "Y-m-d H:i:s" in order to work with MySQL datetime field.

i.e. :

$lastupdated = date('Y-m-d H:i:s');

From documentation :

The DATETIME type is used for values that contain both date and time parts. MySQL retrieves and displays DATETIME values in 'YYYY-MM-DD HH:MM:SS' format. The supported range is ‘1000-01-01 00:00:00’ to ‘9999-12-31 23:59:59’.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read

Leave a Comment