石墨消解仪后端用nodejs编写,与嵌入式端交互和前端交互均用ws
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.

14 lines
511 B

2 years ago
  1. function generateSerialNumber() {
  2. const now = new Date();
  3. const year = now.getFullYear(); //得到年份
  4. const month = now.getMonth() + 1; //得到月份
  5. const date = now.getDate(); //得到日期
  6. const hour = now.getHours(); //得到小时数
  7. const minute = now.getMinutes(); //得到分钟数
  8. const second = now.getSeconds(); //得到秒数
  9. const time = now.getTime();
  10. return `${year}${month}${date}${hour}${minute}${second}${time}`;
  11. }
  12. const res = generateSerialNumber();
  13. console.log(res);