JRS: In article <59**************************@posting.google.com >, seen
in news:comp.lang.javascript, bdwise <br************@hotmail.com> posted
at Mon, 2 Feb 2004 14:48:02 :-
I have a textbox in a form, and I need to allow users to enter dates
in US Format (MM/DD/YYYY). But they do not want to type any slashes,
just 8 numbers, and have the slashes added for them.
Evidently you did not read the FAQ with sufficient care. The following
will do the job for UK dates.
S = S.replace(/(\d\d)(\d\d)(\d{4})/, "$1/$2/$3")
The following will convert un-punctuated UK dates to ISO-8601
S = S.replace(/(\d\d)(\d\d)(\d{4})/, "$3-$2-$1")
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.