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

Discuss and share scripts and script files...
Post Reply
drjs5x
Posts: 152
Joined: 18 Nov 2015 18:12
Location: Turkey

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

Post by drjs5x »

hi dear coders
how can convert 20200605 to 2020_06_05 etc... ?
Sincerely
newbie or not...........

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

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

Post 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);
One of my scripts helped you out? Please donate via Paypal

drjs5x
Posts: 152
Joined: 18 Nov 2015 18:12
Location: Turkey

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

Post by drjs5x »

thank you very much dear coder.
:appl:
newbie or not...........

Post Reply