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

72
Views
Remove fields not needed from date input

I used the following script to autofill an input date with current date/time

var today = moment().format('YYYY-MM-DD');
document.getElementById("MyDate").value = today; 

Output :

Date : 2022-03-09 11:39:19.000000,3,Europe/Berlin

Would it be possible to remove the timezone... etc.

So the output will look like :

Date : 2022-03-09 11:39:19
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you can use moment().utc() before format the date to have an universal date and then format it as expected

var today = moment().utc().format('YYYY-MM-DD');
document.getElementById("MyDate").value = today; 
<div>
  Date : <input id ="MyDate"/>
</div>
<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!