Home > Q&A > body text
'2017-6-5'.replace(/-(\d{1})$|-/g,'0'),返回为什么是20170605,少了"-",我要的结果是2017-06-05
为情所困2017-07-05 11:07:19
'2017-6-5'.replace(/-(d{1})/g,'-0$1') Try writing it like this.
'2017-6-5'.replace(/-(d{1})/g,'-0$1')