Where date_object is any date object reference which is to be converted into string format according to the GMT.
To understand the use of toGMTString() method in a better way let's go with a simple example. In this example we have converted current date to the string format according to GMT.
Description of code :
In this example code we have created a button which calls the function "convertToGMTString()" on the click event, which is defined in the <script></script> tags. It calls the toGMTString() method by the current date object and converted date is shown in an alert message. Here is the full example code as follows :
Click on the button "Convert current date to GMT String"
As you can see from the above output that it shows the converted current date in an alert message box.
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial