JavaScript string to date

In JavaScript you can convert a string representing a valid date to a date value by using the Date object. Sometimes converting a string to a date value can be a problem because different browsers support different date formats, and the standard date formats can also be different in different countries. However, the problem can be solved by writing the name of month rather than the number of month.
<html>
<head>
<title>Convert string to date</title>

</head>
<body>
<div id="disp" style=" font-weight: bold; color: #cc9900" ></div>
<script type="text/javascript">
var stdate="08 March 2013";
var dt=new Date(stdate);
document.getElementById("disp").innerHTML="The women right day: "+dt;


</script>
</body>
</html>

Posted by: Dara | post date: 03-07-2013 | Subject: JavaScript




This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.