Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

date string to date in js

var parts ='2014-04-03'.split('-');
// Please pay attention to the month (parts[1]); JavaScript counts months from 0:
// January - 0, February - 1, etc.
var mydate = new Date(parts[0], parts[1] - 1, parts[2]); 
console.log(mydate.toDateString());
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #date #string #date #js
ADD COMMENT
Topic
Name
7+5 =