MySQL Forums
Forum List  »  PHP

Re: Unexpected Data truncated for Date
Posted by: James Cobban
Date: June 12, 2019 03:58PM

Thank you but I do not have a PHP date object and the process for creating one is unnecessarily convoluted when the PHP builtin functions are inadequate.That is the functions do not really work outside of the USA or for anything other than routine data processing applications. For example the PHP date value cannot express a date outside the range 13 Dec 1901 to 19 Jan 2038 because it is just a wrapper around the UNIX 32 bit seconds counter

Valid dates in my application include 'March 15th 44 BC', 'Ides Martius DCCXI AUC', 'February 22nd, 1732 OS', and '18 Brumaire VII'. I am further frustrated because the SQL DATE type arbitrarily cannot handle dates prior to 1 Jan 1000 so I keep having commands fail with dates that are valid for my application.

I see many examples in MySQL documentation along the lines of UPDATE Table SET datefield='2015-04-23' so why am I unable to do that in this case? Even when I copy the text of the command from the error message I posted in the initial message of this thread and issue it to MySQL through the command line tool if barfs.

I have spent several hours and I cannot find any description in the PDO documentation or any of the forums describing this. As far as I can tell the word "DATE" does not even occur in the official PDO documentation. Almost everything in the forums discusses only setting the value to NOW() or describes doing the process using the obsolete mysqli interface. But I need a database field type that I can compare for range in an intuitive way. INT is not intuitive. Iwish towrite my coe in a platform agnostic way but for some reason the SQL standard is a secret which is only available to people who can afford to buy it, and none of the online documentation for any of the implementations ever seems to discuss compliance to the standard so, for example, I cannot tell which releases of which servers support BIGINT.

Options: ReplyQuote


Subject
Written By
Posted
Re: Unexpected Data truncated for Date
June 12, 2019 03:58PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.