Re: Changing a field's data in every record
- Date: Thu, 2 Mar 2017 08:48:29 -0500
- From: "Hal.sz S.ndor" <hsv@xxxxxxxx>
- Subject: Re: Changing a field's data in every record
2017/02/18 ... debt:
Is there a formula to change the format of the data in a single field in every record of a table? She has a "timestamp” in a text field formatted as 2017|02|16|04|58|42 and she wants to convert it to a more human readable format like 2017-02-16 @ 04:58:42
It now occurs to me, long after a working answer has been found, that because MySQL is none too picky about the strings that it turns into timestamps, that adding a DATETIME field, TS say, and thus updating is enough programming:
UPDATE tbl SET TS=timestampFormatted_CharacterStringfield;MySQL takes any punctuation for a separator, and cares only about the numerals between the separators.
There is also the function STR_TO_DATE which takes a string to convert and a format string.
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql