Lấy ngày hiện tại trong javascript

date,tipjs,function

Lấy ngày hiện tại trong javascript

const getDay = (fillFlag=true) => {
  const day = new Date().getDate()
  const dayRe = day
  if (fillFlag) day < 10 ? `0${day}` : day
  return dayRe
}

//Ouput:
console.log(getDay());//27

Có thể bạn đã miss một số snippets code

Merge Array

How to combine two sorted arrays into one? We can do this easily with the spread operator.

closure javascript

closure javascript

Remove array of objects from another array of objects

Remove array of objects from another array of objects

Converting Object to an Array

Converting Object to an Array

formatdate js

JavaScript’s Date() function object contains a long list of methods that can be used to manipulate the date outcome