Answers for "how to identify date format in javascript"

PHP
16

get date javascript format

var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
var today  = new Date();

console.log(today.toLocaleDateString("en-US")); // 9/17/2016
console.log(today.toLocaleDateString("en-US", options)); // Saturday, September 17, 2016
console.log(today.toLocaleDateString("hi-IN", options)); // शनिवार, 17 सितंबर 2016
Posted by: Guest on April-20-2021
-1

check date format javascript

if (date.match(/^d{4}-d{2}-d{2}$/) === null) {
   //it is not a date with format YYYY-MM-DD
 }
else 
  //it is a date with format YYYY-MM-DD
Posted by: Guest on June-11-2021

Code answers related to "how to identify date format in javascript"

Browse Popular Code Answers by Language