TimeZone time Zone (JS. NET JSON)

Source: Internet
Author: User
Tags time zones local time

SOURCE Reference: Http://www.cnblogs.com/qiuyi21/archive/2008/03/04/1089456.html

The entire Earth is divided into 24 time zones, each with its own local time. In international radiocommunication situations, for the sake of unification, a uniform time is used, known as universal Coordination (UTC, Universal-time coordinated). UTC, like Greenwich Mean Time (GMT, Greenwich Mean time), is the same as in London, England. In this article, UTC and GMT mean exactly the same.

When we do web development, we often deal with some time formats.

There are basically 3 of cases:

For example, the server is located in the United States (UTC-6.00), the company in China (utc+8.00), customers in Hawaii visit (UTC-10.00)

Then we have several possible ways to deal with it, such as the hope that all business has been China's time standard.

When a Date object is serialized, it becomes a string "2014-11-19t23:00:25.571z" or "2014-11-20t07:02:20.6001565+08:00"

The difference is in the last word, z means this is a UTC time, +08:00 means it is a time with jet lag (local time) we can calculate UTC with 2014-11-20t07:02:20.6001565.

By default, JavaScript's json.stringify will convert our time objects to a UTC time, the "2014-11-19t23:00:25.571z" format.

The new Date ("string") translates the cost of time when it encounters the "2014-11-19t23:00:25.571z" format.

In JS where you serialize, deserialize back, the value of the time object is the same.

However, when we communicate with the server, we should pay attention to.

For example, when I use Json.NET, the jsonconvert.deserializeobject<list<datetime>> (JSON) is deserialized by default;

It does not make special conversions for UTC time, and so on.

TimeZone time Zone (JS. NET JSON)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.