Just RUN

A scientist builds in order to learn; an engineer learns in order to build.

忽然有人问我如何替换"2004-9-6" -> "2004-09-06"。

想了一会,发现技能放久了不用会生锈地。


var theDateString = "2004-9-6";

theDateString = theDateString.replace(/-(\d{1})(?=-|$)/g, "-0$1");

posted on 2004-09-29 16:19    阅读(441)  评论(0编辑  收藏  举报

导航