Search code examples
mysqlformatsybase

Changing the format of data inputs for dates. From sybase to mysql


Changing the format of data inputs for dates. From sybase to MySQL

I am trying to see if there is a way to change the data format of dates from

Sybase(YYYYMMDD) to MySQL(YYYY-MM-DD)

I exported a Schema Script from Sybase to be use/migrate to MySQL but for one of my tables the data for the dates were enter as YYYYMMDD and is not recognize by MySQL so it just zeroes it out when attempting to insert the data.

updated format


Solution

  • You can use function STR_TO_DATE to format from sybase format to MySQL format https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_str-to-date