Home Convert datetime-local to UTC time in js/jquery
Reply: 0

Convert datetime-local to UTC time in js/jquery

user716 Published in April 26, 2018, 9:03 pm

I have a form that a user can input a datetime

<input class="form-control" name="aution_end_time" required type="datetime-local id="auction_end_time-input">

Now what I would like to do is convert this "local datetime object" to UTC time and store that value in a hidden input of the form.

<input type="hidden" class="form-control" name="auction_end_time_utc">

How would I go about this? To summarize: user enters a datetime in the form, then once they do that the hidden input gets updated with the same datetime but in UTC. I am unsure of how to determine the users local time zone and how to convert to UTC. Thanks!

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.3096 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO