Answers for "javascript date format yyyy-mm-dd h:i"

3

javascript get current date yyyy-mm-dd

var todayDate = new Date().toISOString().slice(0, 10);
console.log(todayDate);
 Run code snippet
Posted by: Guest on October-26-2021
20

javascript date today dd mm yyyy

var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
var yyyy = today.getFullYear();

today = mm + '/' + dd + '/' + yyyy;
document.write(today);
Posted by: Guest on February-27-2020
0

javascript date format dd-mm-yyyy

var date_format = new Date();
    document.write(innerHTML = date_format.getMonth()+'-'+ date_format.getDate()+'-'+date_format.getFullYear());
Posted by: Guest on July-09-2020
0

javascript yyyy-mm-dd to mm-dd-yyyy human readable format

function formatDate(DB_date){
  // Get Date from DB then format it to be human readable
// DB_date comes in as yyyy-mm-dd which throws off the date format by one day
 var ymdSplit = DB_date.split('-');
 // so we split it into an array and then we can use the array to create a new date object
// console.log(ymdSplit[0])
// console.log(ymdSplit[1])
// console.log(ymdSplit[2])
 var d = new Date(""+ymdSplit[1]+"/"+ymdSplit[2]+"/"+ymdSplit[0]+"");
// re-assembles the date object into a string
// console.log(d)
var wd = d.getDay();
var mo = d.getMonth();
let weekdays = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
let months = ["January","February","March","April","May","June","July","August","September","October","November","December"];
// console.log(weekdays[wd])
// console.log(months[mo])
  // return this function so it comes back as: Tuesday, March 15th, 2022 :) all done!
return weekdays[wd] + ", " + months[mo] + " " + ymdSplit[2] + ", " + ymdSplit[0];
}
Posted by: Guest on April-04-2022

Code answers related to "javascript date format yyyy-mm-dd h:i"

Code answers related to "Javascript"

Browse Popular Code Answers by Language