Web lists-archives.com

Re: Changing a field's data in every record




On 2/18/2017 15:13, debt wrote:
	I’ve been asked to post a question here for a friend.

	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

	How does one "grab" the existing data and then change it?

If it's a timestamp, it's saved as 2017-02-16 04:58:42, not as you showed it, and there's no need to change it, indeed she couldn't. Instead, in a query that retrieves the timestamp, use the mysql date_format() function to format the timestamp as desired.

PB

   Can this be done solely in MySQL, or will she have to grab the data and then manipulate it in PHP or something?

Thanks,
Marc


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql