Image

Imageidlechic wrote in Imagejavascript

time validation and converting military time

let me start by saying i don't know javascript. i'm stealing it all. but i'm a good person!



i found a script that does almost exactly what i need. then i found another script that does the only thing the first one doesn't do. i've failed miserably at combining the two, so i've come to you for help. what i need is a script to validate time in a text box. it should accept am/pm or military time, but if it's fed military time, it needs to convert it to am/pm. it needs to do so with an onBlur. i've got the validation working with the onBlur, but i don't have it converting military time. here's the script i'm using now:



i really don't even need the seconds in the time, but i figured i'd leave them there rather than risking breaking it. is there an easy way to make this change military time to am/pm? thanks in advance.