Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

209
Views
How to Convert Timestamp to more readable Time with String

So I'm using Timestamps in Mongoose but the format is this: 2021-12-09T08:35:44.189Z, but I don't want to show this way, instead what I want is: 9 December 2021.

What is the approach to it? as I haven't found any.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

If you will do it by your self , first you can use new Date("2021-12-09T08:35:44.189Z") to get the timeStemp of this date ,and then , use the api: getFullYear、 getMonth、getDate() to get the year、month and date ,then join it by yourself;

let timeStamp = new Date('2021-12-09T08:35:44.189Z');

let year = timeStamp.getFullYear(),
    month = timeStamp.getMonth(),
    date = timeStam.getDate();

or you can also use the third-party like day.js to help you do the same thing

about 4 years ago · Juan Pablo Isaza Report

0

The fastest way is to use moment.js. One-line solution:

console.log(moment('2021-12-09T08:35:44.189Z').format('D MMMM YYYY'));
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js"></script>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!