Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js get date from datetime

new Date().toLocaleDateString('en-CA');
// output: YYYY-mm-DD
new Date().toLocaleDateString('en-CA').replace(/-/g, ".");
//output: YYYY.mm.DD
new Date().toLocaleDateString('en-GB');
// output: DD/mm/YYYY
new Date().toLocaleDateString('en-CA').replace(///g, ".");
//output: DD.mm.YYYY
 
PREVIOUS NEXT
Tagged: #js #date #datetime
ADD COMMENT
Topic
Name
1+9 =