Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

format date in javascript

const formatDate = date => {
  return (
    date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
  );
};

console.log(formatDate(new Date()));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #format #date #javascript
ADD COMMENT
Topic
Name
1+4 =