如何使用JavaScript提取UTC日期? [英] How to fetch UTC dates with JavaScript?

查看:96
本文介绍了如何使用JavaScript提取UTC日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用Javascript获取当前的UTC日期。我怎样才能做到这一点?似乎有一些方法可以获取UTC时间:

I want to get the current UTC date with Javascript. How can I do this? There seems to be methods for getting the time in UTC:

date.getUTCHours();

如何获取日期

推荐答案

日期整年小时分钟月份。要明确获取日期,您可能会发现 getUTCDate 很有用。

There are UTC getters for date, day, full year, hour, minutes, month, etc. To get the date specifically, you might find getUTCDate useful.

没有看到更多代码,我只能建议这样做:

Without seeing more of your code, I can only suggest this:

date.getUTCDate();

这篇关于如何使用JavaScript提取UTC日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆