Answers for "change date format in javascript"

4

javascript format date yyyy-mm-dd

let today = new Date()
today.toISOString().split('T')[0]
Posted by: Guest on August-27-2020
18

javascript convert date to yyyy-mm-dd

// `date` is a `Date` object
const formatYmd = date => date.toISOString().slice(0, 10);

// Example
formatYmd(new Date());      // 2020-05-06
Posted by: Guest on July-03-2020
13

format date js

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

 // For custom format use
 date.toLocaleDateString("en-US", { day: 'numeric' })+ "-"+ date.toLocaleDateString("en-US", { month: 'short' })+ "-" + date.toLocaleDateString("en-US", { year: 'numeric' }) // 16-Nov-2019
Posted by: Guest on November-02-2020
1

javascript date format mm/dd/yyyy

var date_format = new Date();

document.write(innerHTML = date_format.getMonth()+'/'+ date_format.getDate()+'/'+date_format.getFullYear());
Posted by: Guest on July-05-2020
0

change datetime format in js

moment().format("dddd, MMMM Do YYYY, h:mm:ss a");
Posted by: Guest on September-16-2021
0

change date format javascript

var d = new Date("2015/03/25");
Posted by: Guest on May-06-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language