Answers for "javascript parse date dd/mm/yyyy hh:mm:ss"

0

javascript date parse yyyy-mm-dd

var dateString = "10/23/2015"; // Oct 23

var dateObject = new Date(dateString);

document.body.innerHTML = dateObject.toString();
Posted by: Guest on November-05-2020
0

javascript get current date format dd mm yyyy hh mm ss

dformat = [d.getDate(), d.getMonth() + 1, d.getFullYear()].join('/') + ' ' + [d.getHours(),d.getMinutes(),d.getSeconds()].join(':');
Posted by: Guest on February-26-2021
0

javascript parse date dd/mm/yyyy hh:mm:ss

let dtStr = "16/03/2010 09:55:35"

console.log(strToDate(dtStr));  // Tue Mar 16 2010 09:55:35

function strToDate(dtStr) {
  if (!dtStr) return null
  let dateParts = dtStr.split("/");
  let timeParts = dateParts[2].split(" ")[1].split(":");
  dateParts[2] = dateParts[2].split(" ")[0];
  // month is 0-based, that's why we need dataParts[1] - 1
  return new Date(+dateParts[2], dateParts[1] - 1, +dateParts[0], timeParts[0], timeParts[1], timeParts[2]);
}
Posted by: Guest on October-14-2021

Code answers related to "javascript parse date dd/mm/yyyy hh:mm:ss"

Code answers related to "Javascript"

Browse Popular Code Answers by Language