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

142
Views
How to convert user date to milliseconds

For now I'm using this long method to convert user input in format: DD.MM.YY HH:mm to milliseconds.

let day = date.substring(0, 2);
let mth = date.substring(3, 5);
let yr = date.substring(6, 10);
let hr = date.substring(11, 13);
let min = date.substring(14, 16);

let d = yr + "-" + mth + "-" + day + "T" + hr + ":" + min + ":00.000+02:00";
d = new Date(d).getTime();

Is there any easier, preferable way to do this? I've read about ISO dates and other norms but I haven't found anything that includes both day/month/year and hours/minutes without unnecessary milliseconds and time zones.

I'm not expert in js dates so be understanding. Thank you in advance.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can try Date.parse which parses a date string. The MDN website has a full write-up on it at: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse

about 4 years ago · Santiago Trujillo 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!