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?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top