WOW… Using MySQL, is there a way to replace the third “-” from the left in the following timestamp:
2012-06-05-23:48:10
You’d think after an hour of searching I would have found something..
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The literal replace operation that you describe is probably beyond the abilities of pure mySQL – it has regex capabilities, but only for matching.
However, one workaround comes to mind:
Convert the field into a DATETIME field using
STR_TO_DATE()then output it using a custom format using
DATE_FORMAT()that said, storing the date as a native
DATETIMEfield in the first place would be a good idea anyway.