简单订单编号生成思路(时间+时间戳)

编程入门 行业动态 更新时间:2024-10-28 02:24:27

简单订单编号生成思路(<a href=https://www.elefans.com/category/jswz/34/1771441.html style=时间+时间戳)"/>

简单订单编号生成思路(时间+时间戳)

简单的订单编号生成思路,即由时间(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

更多推荐

简单订单编号生成思路(时间+时间戳)

本文发布于:2023-07-28 15:42:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1239018.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:时间   思路   订单   编号   简单

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!