Hi all, could not find the format for DD could not find the format for DD-MMM-YY HH:MM:SS AM/PM through
http://regexlib.com/, please advise if you have a regular expression for this format. Thankssss..
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.123aspx.com, and
www.411asp.net. I'm the author of
one product that contains datetextbox with popup calendar, timeofdaytextbox and validators.
--- Peter Blum
Creator of Peter's Data Entry Suite (formerly Professional Validation And More and Peter's Date Package) and Peter's Polling Package
www.PeterBlum.com
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
louen84
Member
6 Points
20 Posts
Regular Expression DD-MMM-YY HH:MM:SS AM/PM
Feb 06, 2007 07:35 AM|LINK
e_screw
All-Star
19530 Points
3894 Posts
Re: Regular Expression DD-MMM-YY HH:MM:SS AM/PM
Feb 06, 2007 08:35 AM|LINK
Check this link http://regexlib.com/REDetails.aspx?regexp_id=505
Thanks
Electronic Screw
Website||Blog||Dub@i.net
PLBlum
All-Star
30399 Points
5347 Posts
MVP
Re: Regular Expression DD-MMM-YY HH:MM:SS AM/PM
Feb 06, 2007 10:15 PM|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.123aspx.com, and www.411asp.net. I'm the author of one product that contains datetextbox with popup calendar, timeofdaytextbox and validators.
Creator of Peter's Data Entry Suite (formerly Professional Validation And More and Peter's Date Package) and Peter's Polling Package
www.PeterBlum.com
louen84
Member
6 Points
20 Posts
Re: Regular Expression DD-MMM-YY HH:MM:SS AM/PM
Feb 07, 2007 12:07 AM|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
louen84
Member
6 Points
20 Posts
Re: Regular Expression DD-MMM-YY HH:MM:SS AM/PM
Feb 07, 2007 12:32 AM|LINK
<globalization culture="en-GB" uiCulture="en-GB"/>