469,276 Members | 1,747 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,276 developers. It's quick & easy.

formatting date

69
Hi guys,

I wanted to find out how i can do this.
I have a textbox on a form. I want the user to enter the date in the format YYYY-MM-DD.
when the user types 4 digits i want a dash('-') to be inserted and then the user will type the other 2 digits and another dash would be inserted and then the next 2 digits can be typed.
How do i insert the dash?

Please help
Nov 26 '07 #1
4 1085
drhowarddrfine
7,435 Expert 4TB
html/css cannot do this. Check on the javascript forum.
Nov 26 '07 #2
phpmel
69
Hi guys,

I wanted to find out how i can do this.
I have a textbox on a form. I want the user to enter the date in the format YYYY-MM-DD.
when the user types 4 digits i want a dash('-') to be inserted and then the user will type the other 2 digits and another dash would be inserted and then the next 2 digits can be typed.
How do i insert the dash?

Please help
Nov 27 '07 #3
acoder
16,027 Expert Mod 8TB
Keep checking the input on every key press.

Once the length is 4, add a dash: inputbox.value+="-".
Nov 27 '07 #4
You cant do that in HTML/CSS

You can do that in JavaScript
Nov 27 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by hope | last post: by
4 posts views Thread by Nalaka | last post: by
2 posts views Thread by Thomas Beyerlein | last post: by
2 posts views Thread by johndcal | last post: by
2 posts views Thread by David Veeneman | last post: by
4 posts views Thread by Ken Wigle | last post: by
6 posts views Thread by Tomasz J | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.