推荐使用: 通过截取函数操作,在拼接的时候需要加个空格,不然会有问题
//js获取当前的时分秒
let myDate = new Date();
let str = myDate.toTimeString(); //"10:55:24 GMT+0800 (中国标准时间)"
let timeStr = str.substring(0,8); // '10:55:24'
//js获取当前的时分秒
let myDate = new Date();
let str = myDate.toTimeString();
let timeStr = str.substring(0,8);
let temp1 = startDate + ' '+ timeStr;
let temp2 = startDate +' ' + timeStr;
sendData['begin_time'] = (new Date(temp1).getTime() / 1000).toFixed(0);
sendData['end_time'] = (new Date(temp2).getTime() / 1000).toFixed(0);
需要手动补零
//js获取当前的时分秒
let myDate = new Date();
let h = myDate.getHours(); // 获取当前小时数(0-23)
let m = myDate.getMinutes(); // 获取当前分钟数(0-59)
let s = myDate.getSeconds();// 获取当前秒数(0-59)
let timeStr = h + ':' + 'm' + 's';
输出: "10:55:24" || "10:55:1 不会自动补零
dateTime: Date;
this.dataTime = new Date(); // 获取当前日期
// Wed Apr 18 2018 10:54:47 GMT+0800 (中国标准时间)
console.log('orderdate:', this.OrderDate);
console.log('toISOString:', this.OrderDate.toISOString());
console.log('toDateString:', this.OrderDate.toDateString());
console.log('toUTCString:', this.OrderDate.toUTCString());
console.log('toJSON:', this.OrderDate.toJSON());
console.log('toLocaleDateString:', this.OrderDate.toLocaleDateString());
console.log('toLocaleString:', this.OrderDate.toLocaleString());
console.log('toLocaleTimeString:', this.OrderDate.toLocaleTimeString());
console.log('toString:', this.OrderDate.toString());
console.log('toTimeString:', this.OrderDate.toTimeString());
// 输出结果:
// toISOString: 2017-12-07T16:33:01.843Z
// toDateString: Fri Dec 08 2017
// toUTCString: Thu, 07 Dec 2017 16:33:01 GMT
// toJSON: 2017-12-07T16:33:01.843Z
// toLocaleDateString: 2017/12/8
// toLocaleString: 2017/12/8 上午12:33:01
// toLocaleTimeString: 上午12:33:01
// toString: Fri Dec 08 2017 00:33:01 GMT+0800 (中国标准时间)
// toTimeString: 00:33:01 GMT+0800 (中国标准时间)
前台html页面日期格式化:
{{ dateTime | date:'yyyy-MM-dd HH:mm:ss'}}
{{ dateTime | date:'medium' }}
{{ dateTime | date:'short' }}
{{ dateTime | date:'fullDate' }}
{{ dateTime | date:'longDate' }}
{{ dateTime | date:'mediumDate' }}
{{ dateTime | date:'shortDate' }}
{{ dateTime | date:'mediumTime' }}
{{ dateTime | date:'shortTime' }}
小模态框
<div class="pop_window js-msg-model" data-type="main" style="display: none">
<div class="big_title">工资结算规则</div>
<div style="text-align: left">
<div style="padding-top: 40px;padding-left: 30px">
<p>应付工资=基础工资+总提成;</p>
<p>基础工资为店员设置里面填写的金额,
基础工资将按照每月天数生成每日的日工资,
结算工资按周结算或者按月结算。</p>
</div>
</div>
</div>