使用VUEJS将UNIX TIMESTAMP转换为迄今

发布于 2025-02-07 17:44:31 字数 115 浏览 2 评论 0原文

我正在AEM担任云服务。在此,使用查询构建器,我将获得JCR:通过Servlet创建页面的日期。为了打电话,我正在使用VUE JS。现在,servlet返回的日期为unix格式。我想使用vuejs将其转换为日期格式。

I am working in AEM as a Cloud Service. In that, using query builder I'm getting jcr:created date of the pages through Servlet. To call that servlet, I'm using Vue JS. Now, the date returned by the servlet is in UNIX format. I want to convert that into date format using VueJS.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

陌上青苔 2025-02-14 17:44:31

使用以下语句:

vueJSdate = new Date(unixTimestamp * 1000);

UNIX时间戳为秒,而date()期望毫秒 - 因此,我们只是乘以1000。请记住,结果日期将在您的本地时区 - 不在您的本地时区 - 不在服务器/数据库。

Use the following statement:

vueJSdate = new Date(unixTimestamp * 1000);

UNIX timestamps are in seconds while Date() expects milliseconds - so we just multiply by 1000. Keep in mind that the resulting date will be in your local timezone - not in the timezone of the server/database.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文