Possible Duplicate:
JavaScript seconds to time with format hh:mm:ss
Seems to me that this is a simple task, but I have not yet managed to make this work.
Essentially, I am starting with a string that contains an ISO-formatted time (HH:MM:SS) and I am wondering how to convert it to H:MM am|pm using JavaScript.
Any help is much appreciated.
This simple function should do the trick:
Should be self-explanatory. See this jsfiddle for example: http://jsfiddle.net/nscXP/3/