JavaScript Date toGMTString() Method Last Updated : 19 Apr, 2023 Comments Improve Suggest changes Like Article Like Report The date.toGMTString() method is used to convert the given date object’s contents into a string according to the Greenwich Mean Time GMT. The date object is created using the date() constructor. Note: This method has been deprecated and has been replaced by the toUTCString() method. Syntax: dateObj.toGMTString() Parameters: This method does not accept any parameter. It is just used along with a Date object created using the Date() constructor whose contents are converted into a string. Return Values: It returns the converted string according to the Greenwich Mean Time GMT. The below examples show the use of the Date toGMTString() method. Example 1: In this example, we will convert a given time and date to GMT. JavaScript <script> // Here a date has been assigned // while creating Date object var dateobj = new Date('October 15, 1996 05:35:32'); // Contents of above date object is converted // into a string using toGMTString() method. var B = dateobj.toGMTString(); // Printing the converted string. console.log(B); </script> Output: Tue, 15 Oct 1996 00:05:32 GMT Example 2: Here nothing is passed as a parameter while creating the date object but the toGMTString() method returns the current day, month, date, year, and time. JavaScript <script type="text/javascript"> var dt = new Date(); console.log( "Formatted Date : " + dt.toGMTString() ); </script> Output: Formatted Date : Mon, 09 Jan 2023 05:54:54 GMT We have a complete list of Javascript Date Objects, to check those please go through this Javascript Date Object Complete reference article. We have a Cheat Sheet on Javascript where we covered all the important topics of Javascript to check those please go through Javascript Cheat Sheet-A Basic guide to JavaScript. Comment More infoAdvertise with us Next Article JavaScript Date toGMTString() Method A amitsingh2730 Follow Improve Article Tags : JavaScript Web Technologies Similar Reads JavaScript Date toString() Method JavaScript date.toString() method is used to convert the given date object's contents into a string. The date object is created using the date() constructor. Syntax:dateObj.toString();Parameters:This method does not accept any parameter. It is just used along with a Date object created using the Dat 3 min read JavaScript Date toUTCString() Method The date.toUTCString() method is used to convert the given date object's contents into a string according to the universal time zone UTC. The date object is created using the date() constructor. Syntax:dateObj.toUTCString()Parameters:This method does not accept any parameter. It is just used along w 4 min read JavaScript Date toDateString() Method The date.toDateString() method converts the given date objectâs contents of the date portion into a string. The date object is created using the date() constructor. Syntax: dateObj.toDateString() Parameters: This method does not accept any parameter. It is just used with a Date object created using 4 min read JavaScript Date toISOString() Method The date.toISOString() method is used to convert the given data objectâs contents into a string in ISO format (ISO 8601) i.e. in the form of (YYYY-MM-DDTHH:mm:ss.sssZ or ±YYYYYY-MM-DDTHH:mm:ss.sssZ). The date object is created using the date() constructor. JavaScriptlet dateobj = new Date('October 1 3 min read JavaScript Date toLocaleTimeString() Method The date.toLocaleTimeString() method is used to fetch the time from a given Date object. Syntax: DateObj.toLocaleTimeString() Parameter: This method does not accept any parameter. It is just used along with a Date Object from which we want to fetch the time. Return Values: It returns a string which 2 min read JavaScript Program to Convert Date to String In this article, we will see how to convert a JavaScript Date to a string using JavaScript. We have a few methods to convert JavaScript Date to string which are described below. Methods to Convert Date to String in JavaScriptTable of Content Using the Date.toString() methodUsing String ConstructorUs 4 min read HijrahDate toString() method in Java with Example The toString() method of java.time.chrono.HijrahDate class is used to represent the hijrah date into the string format.Syntax: public String toString() Parameter: This method does not accept any argument as a parameter.Return Value: This method returns the hijrah date into the string format.Below ar 2 min read ThaiBuddhistDate toString() method in Java with Example The toString() method of java.time.chrono.ThaiBuddhistDate class is used to represent this ThaiBuddhist date in a string format. The method simply returns the text-format of this object which is easy to read and contains the required information of the date. Syntax: public String toString() Override 2 min read LocalDate toString() method in Java with Examples The toString() method of a LocalDate class is used to get this date as a String, such as 2019-01-01.The output will be in the ISO-8601 format uuuu-MM-dd. Syntax: public String toString() Parameters: This method does not accepts any parameters. Return value: This method returns String which is the re 1 min read Like