//获取并格式化当前时间
var _getTime = function(){
var arr=['00','01','02','03','04','05','06','0,'08','09'], //补零
d = new Date(),
h = d.getHours(),
m = d.getMinutes(),
s = d.getSeconds();
return [ arr[h] ||h, arr[m] ||m, arr[s] ||s .join(":");
};
//当h不为个数时,arr[h]下标超界返回undefind,arr[h]||h 取h的值。
相关文章
- 08-200-完全开源的 Vue.js 入门级教程:HelloVue,发车啦!
- 08-20Python 自动给数字前面补0
- 08-20vue.runtime.esm.js?2b0e:619 [Vue warn]:Computed property “imgUrl“ was assigned to but it has no sett
- 08-20一位数左边补0,slice也可以
- 08-20Nuxt.js框架启动报错: 35 errors, 0 warnings potentially fixable with the `--fix` option.
- 08-20七个简单但棘手的 JS 面试问题[每日前端夜话0xD4]
- 08-20js正则0-100之间的正整数
- 08-20runtime-core.esm-bundler.js?5c40:6748 Uncaught TypeError: Cannot create property ‘id‘ on number ‘0‘
- 08-20SqlServer时间格式不足2位补0
- 08-20LeetCode 67. Add Binary【个位补0,不必对齐】【easy】