Home  >  Article  >  Web Front-end  >  The JavaScript method toUTCString() converts a Date object into a string according to universal time and returns the result.

The JavaScript method toUTCString() converts a Date object into a string according to universal time and returns the result.

黄舟
黄舟Original
2017-11-08 13:22:191613browse

Definition and Usage

toUTCString() method can convert Date object to String according to Universal Time (UTC), and return the result.

Syntax

dateObject.toUTCString()

Return value

String representation of dateObject, expressed in universal time.

Example

Example 1

In the following example, we will use toUTCString() to convert today's date to a string (according to UTC):

Output:

Wed, 08 Nov 2017 05:21:56 GMT

Example 2

In the following example, we will convert a specific date into a string (according to UTC):

Output :

Wed, 20 Jul 1983 17:15:00 GMT

How to use toUTCString() to convert today's date to a string (according to UTC).







Result:

Wed, 08 Nov 2017 05:23:18 GMT


The above is the detailed content of The JavaScript method toUTCString() converts a Date object into a string according to universal time and returns the result.. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn