徐总多门店
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

23 lines
526 B

var helperGetDateTime = require('./helperGetDateTime')
var now = require('./now')
var toStringDate = require('./toStringDate')
var isDate = require('./isDate')
/**
* 将日期格式化为时间戳
*
* @param {String/Number/Date} str 日期或数字
* @param {String} format 解析日期格式
* @returns Number
*/
var timestamp = function (str, format) {
if (str) {
var date = toStringDate(str, format)
return isDate(date) ? helperGetDateTime(date) : date
}
return now()
}
module.exports = timestamp