javascript format date yyyy-mm-dd
// yyyy-mm-dd
new Date().toISOString().slice(0, 10)
javascript format date yyyy-mm-dd
// yyyy-mm-dd
new Date().toISOString().slice(0, 10)
javascript format date yyyy-mm-dd
let today = new Date()
today.toISOString().split('T')[0]
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
get current date javascript yyyy-mm-dd
function pad2(n) {
return (n < 10 ? '0' : '') + n;
}
var date = new Date();
var month = pad2(date.getMonth()+1);//months (0-11)
var day = pad2(date.getDate());//day (1-31)
var year= date.getFullYear();
var formattedDate = year+"-"+month+"-"+day;
alert(formattedDate); //2021-02-28
get yyyy-mm-dd hh:mm from date javascript
var d = new Date,
dformat = [(d.getMonth()+1).padLeft(),
d.getDate().padLeft(),
d.getFullYear()].join('/') +' ' +
[d.getHours().padLeft(),
d.getMinutes().padLeft(),
d.getSeconds().padLeft()].join(':');
//=> dformat => '05/17/2012 10:52:21'
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us