Answers for "different date format in javascript"

1

format date in javascript

const formatDate = date => {
  return (
    date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
  );
};

console.log(formatDate(new Date()));
Posted by: Guest on September-13-2021
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

Format Date Javascript

const dateStr = '2020-06-21T10:15:00Z',
      
      [yyyy,mm,dd,hh,mi] = dateStr.split(/[/:\-T]/)
      
console.log(`${dd}-${mm}-${yyyy} ${hh}:${mi}`)
Posted by: Guest on April-19-2021

Code answers related to "different date format in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language