Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

convert date to string format dd/mm/yyyy javascript

// Convert Date.now() to Formatted Date in "dd-MM-YYYY".
function convertDate(inputFormat) {
  function pad(s) { return (s < 10) ? '0' + s : s; }
  var d = new Date(inputFormat)
  return [pad(d.getDate()), pad(d.getMonth()+1), d.getFullYear()].join('-')
}

console.log(convertDate('Mon Nov 19 13:29:40 2012')) // => "19-11-2012"
Comment

DD/MM/YYYY format to date JavaScript

const str = '22/04/2022';

const [day, month, year] = str.split('/');

console.log(day); //  22
console.log(month); //  04
console.log(year); //  2022

const date = new Date(+year, month - 1, +day);
console.log(date); //  Fri Apr 22 2022
Comment

PREVIOUS NEXT
Code Example
Javascript :: js loading spinner 
Javascript :: reverse string with recursion 
Javascript :: discord.js checking channel permissions 
Javascript :: ngrok live port vue js 
Javascript :: diff in javascript 
Javascript :: nodemailer, mailer, nodemailer npm 
Javascript :: how to add number in string in javascript 
Javascript :: addition of all elements of array in js 
Javascript :: window.print filename 
Javascript :: jquery select option by value 
Javascript :: get current file name javascript 
Javascript :: get id of an element 
Javascript :: convert Float64Array to array in js 
Javascript :: node js response header 
Javascript :: return all trs in a table jqueyr 
Javascript :: regex in mongo query 
Javascript :: check if all values in array are negative javascript 
Javascript :: using fetch api 
Javascript :: exporting a class 
Javascript :: javascript select multiple values 
Javascript :: generate random color 
Javascript :: react native vector icons 
Javascript :: all &nbsp; to space from string javascript 
Javascript :: check type of variable in javascript 
Javascript :: javascript trim string 
Javascript :: how to loop trough an object java script 
Javascript :: javascript duplicate an array 
Javascript :: Multiple children were passed to <Link with `href` of `/escritorio/opcion1` but only one child is supported 
Javascript :: editor js to html 
Javascript :: how to get variable value outside function in javascript 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =