Question

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.

Was it helpful?

Solution

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?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top