JavaScript - Date toUTCString Method


Advertisements


Description

This method converts a date to a string, using the universal time convention.

Syntax

Its syntax is as follows −

Date.toTimeString ()

Return Value

Returns converted date to a string, using the universal time convention.

Example

Try the following example.

Live Demo
<html>
   <head>
      <title>JavaScript toUTCString Method</title>
   </head>
   
   <body>      
      <script type = "text/javascript">
         var dateobject = new Date(1993, 6, 28, 14, 39, 7);
         document.write( dateobject.toUTCString() ); 
      </script>     
   </body>
</html>

Output

Wed, 28 Jul 1993 09:09:07 GMT

javascript_date_object.htm

Advertisements