简体   繁体   中英

Convert IST (Indian Standard Time) time to any other standard time in JavaScript

I am a novice in JavaScript.

My need is to change IST (Indian Standard Time) time to any other standard. For Example PST (Pakistan Standard Time). User enters IST time 10:30(HH:MM) in a text field. How can I convert this time to PST.

how change user input time like 10:30(HH:MM)

You can use a split on the input value:

var parts = inputElement.value.split(':'),
    hours = parseInt(parts[0], 10),
    mins  = parseInt(parts[1], 10);

(error checking should of course be applied as well).

Then use this answer as Justin K references:
Javascript countdown using absolute timezone?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM