1 Star 2 Fork 4

yige/git-auto-commit

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
add.js 949 Bytes
一键复制 编辑 原始数据 按行查看 历史
yige 提交于 7年前 . git auto commit
//日期格式化,格式化后:2018-01-26 21:25:12
Date.prototype.format = function(format) {
var o = {
"M+": this.getMonth() + 1, //month
"d+": this.getDate(), //day
"h+": this.getHours(), //hour
"m+": this.getMinutes(), //minute
"s+": this.getSeconds(), //second
"q+": Math.floor((this.getMonth() + 3) / 3), //quarter
"S": this.getMilliseconds() //millisecond
}
if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
(this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(format))
format = format.replace(RegExp.$1,
RegExp.$1.length == 1 ? o[k] :
("00" + o[k]).substr(("" + o[k]).length));
return format;
}
let fs = require('fs');
let time = (new Date()).format("yyyy年MM月dd日 hh:mm:ss");
fs.appendFileSync('records.txt', `${time}\n\n`);
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yi-ge/git-auto-commit.git
git@gitee.com:yi-ge/git-auto-commit.git
yi-ge
git-auto-commit
git-auto-commit
master

搜索帮助