1

I am working on a web-based application that will require users to enter a start and end time

I find selection boxes annoying for that purpose, and I am looking for any javascript functions that will interpret most entries that a user could put for example:

1p, 1pm, 1:00pm, 13, 13:00 would all be 1:00PM

I know I can write it, but if someone has already written a comprehensive one, it would be appreciated.

Thanks,

Irfan jamal
  • 529
  • 2
  • 8
  • 21

1 Answers1

1

Checkout Date.JS. The sample parser on their website correctly parses all the formats you have listed except 13, which it considers to be the date and parses as Dec 13 instead of 1PM.

Anurag
  • 140,337
  • 36
  • 221
  • 257
  • thanks...I checked it out, but it doesn't really suit my needs...a bit too robust – Irfan jamal Dec 22 '11 at 16:57
  • for anybody interested in using datejs for this purpose, this post may help you http://stackoverflow.com/questions/4012702/parse-only-a-time-string-with-datejs – Irfan jamal Dec 22 '11 at 16:58