Tutorial Gateway

  • C Language
  • Java
  • R
  • SQL
  • MySQL
  • Python
  • BI Tools
    • Informatica
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • QlikView
  • Js

JavaScript toDateString

by suresh

The JavaScript toDateString function returns the Date portion of a given date in a human-readable format. The syntax of the JavaScript toDateString Date function is:

 Date.toDateString()

JavaScript toDateString Function Example

We use the toDateString function to return the data portion of today’s date.

<!DOCTYPE html>
<html>
<head>
    <title> JavaScript toDateString Function  </title>
</head>
<body>
    <h1> JavaScript toDateString Example </h1>
<script>
  var dt = Date();  
  document.write("Date and Time : " + dt + "<br/>");

  var x = dt.toDateString();
  document.write("After toDateString() = " + x);
</script>
</body>
</html>

OUTPUT

JavaScript toDateString Function 1

JavaScript to Date String Function Example 2

This toDateString example returns the string date of a custom date in a human-readable format.

<!DOCTYPE html>
<html>
<head>
    <title> JavaScript toDateString Function  </title>
</head>
<body>
    <h1> JavaScript toDateString Example </h1>
<script>
  var dt = Date(2017, 5, 15, 10, 11, 19);
  document.write("Date and Time : " + dt + "<br/>");

  var x = dt.toDateString();
  document.write("After toDateString() = " + x);
</script>
</body>
</html>

OUTPUT

JavaScript toDateString Function 2

Placed Under: JavaScript

Trending Posts

Create a Ribbon Chart in Power BI

Java String matches Method

Python Calendar Example

Nested Transactions in SQL Server

BULK INSERT in SQL Server

C fabs Function

SQL STDEVP Function

Python Program to find Perfect Number

Python upper

SSIS Lookup Transformation in Full Cache Mode

  • C Programs
  • Java Programs
  • SQL FAQ’s
  • Python Programs
  • SSIS
  • Tableau
  • JavaScript

Copyright © 2019 | Tutorial Gateway· All Rights Reserved by Suresh

Home | About Us | Contact Us | Privacy Policy