Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize ISO date display by JavaScript

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "JavaScript how to achieve ISO date display", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "JavaScript how to achieve ISO date display" bar!

The JavaScript ISO date shows:

ISO 8601 is the international standard for showing date and time.

ISO 8601 syntax (YYYY-MM-DD) is also the preferred JavaScript date format:

Instance (full date)

Var d = new Date ("2018-02-19")

The calculated date is relative to your time zone.

Depending on your time zone, the above results will change between February 18 and February 19.

ISO date (year and month)

It is possible to write a date without specifying a specific date (YYYY-MM):

Var d = new Date ("2015-03")

The time zone will change the results between February 28 and March 1.

ISO date (year only)

It is possible to write a date without specifying a specific month and day (YYYY):

Var d = new Date ("2018")

The time zone changes the results between December 31, 2017 and January 1, 2018.

ISO date (full date overtime, minutes, and seconds)

You can also add hours, minutes, and seconds (YYYY-MM-DDTHH:MM:SS) to write dates:

Var d = new Date ("2018-02-19T12:00:00")

The date and time are separated by the capital letter T.

UTC time is defined by the uppercase letter Z.

If you want to change the time relative to UTC, delete Z and replace it with + HH:MM or-HH:MM:

Example

Var d = new Date ("2018-02-19T12:00:00-08:30")

UTC (Universal Time Coordinated) is equivalent to GMT (Greenwich mean time).

Note: UTC, coordinated Universal time, also known as Universal Unified time, Universal Standard time, International coordinated time.

Omitting T or Z in the date-time string produces different results in different browsers.

Thank you for your reading, the above is the content of "JavaScript how to achieve ISO date display", after the study of this article, I believe you have a deeper understanding of how to achieve ISO date display in JavaScript, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report