Page 1 of 1

how can convert 20200605 to 2020_06_05 etc... ?

Posted: 09 Nov 2020 07:39
by drjs5x
hi dear coders
how can convert 20200605 to 2020_06_05 etc... ?
Sincerely

Re: how can convert 20200605 to 2020_06_05 etc... ?

Posted: 09 Nov 2020 07:44
by highend

Code: Select all

$string = "20200605";
    text regexreplace($string, "^(\d{4})(\d{2})(\d{2})$", "$1_$2_$3");
    text substr($string, 0, 4) . "_" . substr($string, 4, 2) . "_" . substr($string, 6, 2);

Re: how can convert 20200605 to 2020_06_05 etc... ?

Posted: 09 Nov 2020 08:39
by drjs5x
thank you very much dear coder.
:appl: