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

301
Views
How to convert mmddyyyy date format to mm/dd/yyyy in nodejs

I have a dateformat

date="11032020"(mmddyyyy)

output expected:11/03/2020

I want to convert this to mm/dd/yyyy in nodejs.I am a begineer to nodejs. I saw many posts where they convert from mm-dd-yyyy to different format or related.I tried converting to ISO but that did not work out.

I am not able to convert mmddyyyy to different format.

Could you please help me out in this.

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

0

If you're certain that the input is MMDDYYYY and don't need to validate it, you could use a regular expression:

let format_date = input => input.replace(/(\d{2})(\d{2})(\d{4})/, "$1/$2/$3")
format_date("11032020") // "11/03/2020"
about 4 years ago · Juan Pablo Isaza Report

0

With moment.js you can do:

const date = "11032020"
const res = moment(date, "MMDDYYYY").format('MM/DD/YYYY')

console.log(res)
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js" integrity="sha512-qTXRIMyZIFb8iQcfjXWCO8+M5Tbc38Qi5WzdPOYZHIlZpzBHG3L3by84BBBOiRGiEb7KKtAOAs5qYdUiZiQNNQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></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!