I am trying to write a 4 digit year into an existing MySQL database. The field type is year with a length of 4. Therefore, one would think that a 4 digit integer would write into it, but it does not. I get a warning saying "MySQL Writer: Skipped feature due to invalid date/time string". This seems extremely basic, but how do I turn a4 digit integer (e.x. 2012) into a date field that MySQL will recognize as a year?
Page 1 / 1
Hi @Tara Preston
In order to write year(4) to MariaDB or MySQL database, the incoming attribute has to be structured as either FME date or ISO date. You can use the DateTimeFormatter transformer to do this.
Thanks @rahulsharma for the quick response. I actually just found a workaround. I had been trying a DateTimeFormatter, but it wasn't working since the feature needing formatted was just a Year. To work around this, I simply used an AttributeManager or AttributeCreator and added a fake month and date to the end of the year (@Value(YR)0101). I didn't even have to use a DateTimeFormatter after this as it was already formatted. Again, thank you for the response though.