Last post Feb 06, 2007 08:32 PM by louen84
Feb 06, 2007 03:35 AM|louen84|LINK
Feb 06, 2007 04:35 AM|e_screw|LINK
Check this link http://regexlib.com/REDetails.aspx?regexp_id=505
Feb 06, 2007 06:15 PM|PLBlum|LINK
You may have an easier time if you separate the date from the time as separate textboxes. Its not hard to get the date only from a DateTime object (DateTime.ToString("dd-MMM-yy")) and the time too (DateTime.ToString("hh:mm:ss tt")).
The advantages are as follows:
- You really need to be sure the date itself is valid, not just the format. (Legal format but illegal value: 31-FEB-2007) Regular expressions are good at patterns, but not values. Converting the string to a date through other means is appropriate. The CompareValidator
can handle dates by setting its Operator property to DataTypeCheck and Type=Date. However, it cannot handle the MMM format. Its limited to digits for the month. People often use the CustomValidator with DateTime.ParseExact(textbox1.text, "dd-MMM-yy", null)
to see if its valid. It throws an exception if it is not.
- You can use a DateTextBox or DatePicker with popup calendar and potentially formatting rules and validators that help you. Many third party date pickers can do this.
- Likewise, you can use a timeTextBox for time entry.
There are a number of third party controls including some free ones. You will find them on this site's Control Gallery (under the Resources tab),
www.411asp.net. I'm the author of
one product that contains datetextbox with popup calendar, timeofdaytextbox and validators.
Feb 06, 2007 08:07 PM|louen84|LINK
Hi PLBlum, thanks for the replies. But im having like 3 text fields of time and date and if i seperate them into 2 text fields of date and time, its going to take up alot of spaces and makes the whole app 'ugly'.
Is there a way to set the whole app's date time format to DD/MM/YYYY HH:MM:SS ? i've run the app locally and it is in DD/MM/YYYY HH:MM:SS format but when i upload to my server it runs as DD/MMM/YY HH:MM:SS format giving me trouble with my validators. I've
check the region date time settings both local and server is the same, anyone have any idea about setting this date time format globally, maybe thru webconfig file or something
Feb 06, 2007 08:32 PM|louen84|LINK