时间+时间戳)"/>
简单订单编号生成思路(时间+时间戳)
简单的订单编号生成思路,即由时间(YYYYMMDD)+时间戳的格式生成。
//自定义订单编号生成规则 由YYYYMMDD(年月日) + 时间戳的格式组成let currDate = new Date();let year = currDate.getFullYear();let month = currDate.getMonth() + 1 < 10 ? "0" + (currDate.getMonth() + 1): currDate.getMonth() + 1;let day = currDate.getDate()<10 ? "0"+currDate.getDate() : currDate.getDate();//获取年月日let date = year + month + day; //20190524//获取当时时间戳let timestamp = Date.parse(currDate); //155866554500//生成订单let orderId = date + timestamp; //20190524155866554500
更多推荐
简单订单编号生成思路(时间+时间戳)
发布评论