PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, January 16, 2022

[FIXED] PHP year 2038 problem with 64bit MySQL can't insert date through PHPMyAdmin

 January 16, 2022     date, laravel, mysql, php, phpmyadmin     No comments   

Issue

I have a MySQL table which has a column called "created_at" which is a TIMESTAMP field. Whenever I try to insert datetime bigger than 2037 I get the following error:

#1292 - Incorrect datetime value: '2039-06-18 16:54:35' for column 'created_at' at row 1

I get that this a problem with 32bit MySQL but I am running 64bit shouldn't that be the solution?

Here is the output of the command for the version of my MySQL:

mysqld  Ver 5.7.26-0ubuntu0.18.04.1 for Linux on x86_64 ((Ubuntu))

Reading this suggesting that using the TIMESTAMP field is the problem and using DATETIME fields will solve it, is that correct?


Solution

TIMESTAMP remains UNIX TIMESTAMP (32Bit) for compatibility reasons...

The suggestion you've read is correct, use DATETIME instead.



Answered By - Lars Stegelitz
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing