howt to convert 2020-02-01T08:54:07.284Z to date in javascript react
//origin
const today = Date.now();
console.log(new Intl.DateTimeFormat('en-US', {year: 'numeric', month: '2-digit',day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit'}).format(today));
//my example:
//here, date is a string which we get from backend api. It is like this: "2020-02-01T08:54:07.284Z"
handleDateFormat = (date) => {
var oldDate = new Date(date);
var formattedDate = new Intl.DateTimeFormat('en-US', { year: 'numeric', month: '2-digit', day: '2-digit' }).format(oldDate);
// console.log(formattedDate);
return formattedDate;
}
Also in JavaScript:
- react google maps get map center
- javascript calculate time
- check if localstorage key exists js
- how to capitalize a letter based on an index in javascript
- ISS proxy express
- define a media query in styled components
- jquery get mouse page left and top
- choose random from array javascript
- firestore set a document
- javascript update url without reload
- node get path of current file
- mvc form client side validation result callback
- how to validate email in node js
- .map function
- react and reactdom dependencies cdn link
- bright green in javascript
- add table row jQuery
- javascript array of cumulative sum
- drupal 8 node has field
- react native header
- javascript swap array elements
- javascript fill array
- javascript includes method getting 'hi' and 'high' problem
- FAILURE: Build failed with an exception react native android