Converting a "timestamp"
[email protected] (Jennifer)
| Newsgroups | php.general |
|---|---|
| Message-ID | <[email protected]> |
I have a "timestamp" written to a text field in MySQL that I need to convert in every record. Currently it is formatted like 2017|02|16|04|58|42 and I want to convert it to this format 2017-02-16 @ 04:58:42 What’s the best way to do this? Do I need to read each record, convert it in PHP, and then insert it back into the table? Or is there a shorter way of doing this that doesn’t require both reading and writing each record? Also, if it’s easier, is there a way to do this directly in MySQL? I’m not really asking for code at this point, as I’m just trying to figure out how to get started. Thank you, Jenni