twofifty Posted November 29, 2007 Share Posted November 29, 2007 Hi. i am using mysql 5.0 i want to insert 29-30 february 0005. i know february has not 29-30 in 0005 but i want to do it. i can do it in my local mysql, but i can't do it in my server. Thx for your reply. Quote Link to comment https://forums.phpfreaks.com/topic/79425-solved-mysql-february-problem/ Share on other sites More sharing options...
obsidian Posted November 29, 2007 Share Posted November 29, 2007 Can't be done: As of 5.0.2, the server requires that month and day values be legal, and not merely in the range 1 to 12 and 1 to 31, respectively. With strict mode disabled, invalid dates such as '2004-04-31' are converted to '0000-00-00' and a warning is generated. With strict mode enabled, invalid dates generate an error. To allow such dates, enable ALLOW_INVALID_DATES. See Section 5.2.6, “SQL Modes”, for more information. If you're wanting to store invalid dates, then you shouldn't be storing them in DATE fields. You would need to store it as a string type and parse it out. Besides that, even when it's pulled into PHP, it would automatically be calculated as March 1. Quote Link to comment https://forums.phpfreaks.com/topic/79425-solved-mysql-february-problem/#findComment-402127 Share on other sites More sharing options...
twofifty Posted November 29, 2007 Author Share Posted November 29, 2007 SET SESSION sql_mode=ALLOW_INVALID_DATES; it works. Quote Link to comment https://forums.phpfreaks.com/topic/79425-solved-mysql-february-problem/#findComment-402152 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.