How do I replace the'-'in a date with'/'?

for example, date = "2018-11-23"
I wrote var date = date.replace ("-", "/")
printed out the result is 2018 code 11-23 .

Dec.08,2021

needs to add g to indicate the global, otherwise it will only match to the first

.
var date = date.replace(/-/g, "/");

the preceding matching parameters are regular /-/ g


clipboard.png

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3555d-4d623.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3555d-4d623.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?