Solved

date format in html

Posted on 2008-06-11
5
176 Views
Last Modified: 2010-04-09
Hi
when i am writing a form in html i have a date field and i want to put in input type="text" name="date" size="10"  maxlength='10'  and at the same i want to put for example   /  /   to strict the user to use 07/06/2008 not an empty field otherwise the user can put anything 07.06.08 or he can put 07-06-08 etc...
0
Comment
Question by:asaidi
  • 4
5 Comments
 
LVL 10

Expert Comment

by:bluefezteam
ID: 21758849
why dont you have 3 fields with 2 characters in each

[DD] / [MM] / [YY]

alternatively you could draw a back ground image with the /  /  drawn on it and apply it to your field and limit it to 6 characters in length....

[     /      /     ]
0
 
LVL 10

Expert Comment

by:bluefezteam
ID: 21758854
with the first method your form can then join the date together to the format you wish
DD/MM/YY
0
 
LVL 10

Expert Comment

by:bluefezteam
ID: 21758865
!!! obviously with the first method I am implying that you add the / / in between the fields as HTML text
0
 

Author Comment

by:asaidi
ID: 21759737
means  i add value in my input type
input type="text" name="date" size="10"  maxlength='10'  value '  /  /   '
0
 
LVL 10

Accepted Solution

by:
bluefezteam earned 500 total points
ID: 21759791
no sorry you would write the code below, so that you have 3 small fields for each part of the date. when you submit the results to your form, the back end code can join them together
<input type="text" name="day" size="2"  maxlength='2'  value="dd" /> / <input type="text" name="month" size="2"  maxlength='2'  value="mm" /> / <input type="text" name="year" size="2"  maxlength='2'  value="yy" />

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now