回复:系统时间设置

罗杰昌

西门子1847工业学习平台

  • 帖子

    6
  • 精华

    0
  • 被关注

    0

论坛等级:新手

注册时间:2023-09-10

黄金 黄金 如何晋级?

发布于 2026-01-06 15:27:36

1楼

因为读回来的是UTC时间,所以有时区时差问题,MTP屏幕的时间脚本我平时用的可供参考:

  const now = new Date();

  const year = now.getFullYear();

  const month = String(now.getMonth() + 1).padStart(2, '0');

  const day = String(now.getDate()).padStart(2, '0');

  const hours = String(now.getHours()).padStart(2, '0');

  const minutes = String(now.getMinutes()).padStart(2, '0');

  const seconds = String(now.getSeconds()).padStart(2, '0');


  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;


评论
编辑推荐: 关闭

请填写推广理由:

本版热门话题

SIMATIC WinCC / Panel

共有32890条技术帖

相关推荐

热门标签

相关帖子推荐

guzhang

恭喜,你发布的帖子

评为精华帖!

快扫描右侧二维码晒一晒吧!

再发帖或跟帖交流2条,就能晋升VIP啦!开启更多专属权限!

  • 分享

  • 只看
    楼主

top
X 图片
您收到0封站内信:
×
×
信息提示
很抱歉!您所访问的页面不存在,或网址发生了变化,请稍后再试。