How to replace a string at a particular position

后端 未结 6 1470
深忆病人
深忆病人 2020-12-10 12:30

Is there a way to replace a portion of a String at a given position in java script. For instance I want to replace 00 in the hours column with 12 i

6条回答
  •  醉梦人生
    2020-12-10 12:56

    A regex approach

    "Mar 16, 2010 00:00 AM".replace(/(.{13}).{2}/,"$112")
    Mar 16, 2010 12:00 AM
    

提交回复
热议问题