This topic is locked
[SOLVED]

 Add a comma to the date-time field

2/7/2021 1:24:41 PM
PHPRunner General questions
A
alfonso authorDevClub member

I have a date-time field that stores the data in this format: 2021-02-05 19:51:44, but I need, for compatibility with a script, that there is a comma separating the date from the time, like this: 2021-02-05, 19:51:44. Have you any solution occurs?

Thank you

S
salus1DevClub member 2/7/2021

<?php

$string = '2021-02-05 19:51:44';

$replacement = ',';

echo substr_replace($string, $replacement, 10, 0);

?>

A
alfonso authorDevClub member 2/8/2021

Perfect!

D
danaci 2/8/2021

..