473,583 Members | 4,428 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Isdate() not working properly

Hi,

I have to validate a textbox for date without using the validation controls.
So i had to use IsDate(). It's not working properly when i give "11//2004".
When i enter the above date it returns true.
What can i do about it??

Regards,
Nita

Nov 18 '05 #1
5 2783
User the validation controls. You could use the regular expression
validation control. There are many regular expressions out there that
validate dates.

"Nita Raju" wrote:
Hi,

I have to validate a textbox for date without using the validation controls.
So i had to use IsDate(). It's not working properly when i give "11//2004".
When i enter the above date it returns true.
What can i do about it??

Regards,
Nita

Nov 18 '05 #2
Or, instead of using the regular expression validator control..you can use
the regular expressio class

"Nita Raju" wrote:
Hi,

I have to validate a textbox for date without using the validation controls.
So i had to use IsDate(). It's not working properly when i give "11//2004".
When i enter the above date it returns true.
What can i do about it??

Regards,
Nita

Nov 18 '05 #3
Several ideas:
1. Use the DateTime object included with .net (which is the underlying code
to IsDate). Call its Parse or ParseExact methods. (See the .net docs for
details). They will throw exceptions when they cannot parse.

2. Seriously, use a validator! The CompareValidato r with
Operator=DataTy peCheck and Type=Date will do the job and provide client-side
validation.

3. Use a third party date textbox that already has the functionality (and so
much more, like a popup calendar). You can find them on www.asp.net Control
Gallery, www.123aspx.com and www.411asp.net. I am the author of one,
"Peter's Date Package" (http://www.peterblum.com/datecontrols/home.aspx). It
includes a popup calendar, keyboard filtering and reformatting, extended
validators, and time entry controls.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlu m.com
Creator of "Profession al Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Nita Raju" <ni*******@hotm ail.com> wrote in message
news:ON******** ******@tk2msftn gp13.phx.gbl...
Hi,

I have to validate a textbox for date without using the validation
controls. So i had to use IsDate(). It's not working properly when i give
"11//2004". When i enter the above date it returns true.
What can i do about it??

Regards,
Nita

Nov 18 '05 #4
Peter,

Is it possible to have the MS compare validator properly check a date
in the format dd-MMM-yyyy either by configuration or extension of the
standard controls? I see a lot of people are using dd/MM/yyyy,
mm/dd/yyyy or even yyyy/mm/dd but we would like to encourage users to
use a format that cannot be confused as to date order

"Peter Blum" <PL****@Blum.in fo> wrote in message news:<e1******* *******@TK2MSFT NGP14.phx.gbl>. ..
Several ideas:
1. Use the DateTime object included with .net (which is the underlying code
to IsDate). Call its Parse or ParseExact methods. (See the .net docs for
details). They will throw exceptions when they cannot parse.

2. Seriously, use a validator! The CompareValidato r with
Operator=DataTy peCheck and Type=Date will do the job and provide client-side
validation.

3. Use a third party date textbox that already has the functionality (and so
much more, like a popup calendar). You can find them on www.asp.net Control
Gallery, www.123aspx.com and www.411asp.net. I am the author of one,
"Peter's Date Package" (http://www.peterblum.com/datecontrols/home.aspx). It
includes a popup calendar, keyboard filtering and reformatting, extended
validators, and time entry controls.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlu m.com
Creator of "Profession al Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Nita Raju" <ni*******@hotm ail.com> wrote in message
news:ON******** ******@tk2msftn gp13.phx.gbl...
Hi,

I have to validate a textbox for date without using the validation
controls. So i had to use IsDate(). It's not working properly when i give
"11//2004". When i enter the above date it returns true.
What can i do about it??

Regards,
Nita

Nov 18 '05 #5
Hi Jeff,

The CompareValidato r will follow the CultureInfo object defined on the
current thread of the page. For example, <@Page Culture="en-GB" >. But it
only supports the DateTimeFormatI nfo.ShortDatePa ttern which never uses MMM,
only MM or M.

My "Peter's Date Package" (http://www.peterblum.com/datecontrols/home.aspx)
can handle this. It's DateTextBox (which includes a fancy popup calendar)
can be set to allow the abbreviated month name. Download the free trial
version and set it up with these settings:

1. Create a DateTimeFormatI nfo object and assign it to the
DateTextBox.xDa teTimeFormatInf o property. See page 34 of the User's Guide.
Set the DateTimeFormatI nfo.ShortDatePa ttern to "dd-MM-yyyy" and
DateTimeFormatI nfo.DateSeparat or = "-".
2. Set the xAllowMonthName s property to "Show"
3. Peter's Date Package includes its own validator, DateTextBoxVali dator,
that will handle this unusual format. So use it for validation.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlu m.com
Creator of "Profession al Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Jeff Knuckey" <je**********@a sggroup.com.au> wrote in message
news:63******** *************** ***@posting.goo gle.com...
Peter,

Is it possible to have the MS compare validator properly check a date
in the format dd-MMM-yyyy either by configuration or extension of the
standard controls? I see a lot of people are using dd/MM/yyyy,
mm/dd/yyyy or even yyyy/mm/dd but we would like to encourage users to
use a format that cannot be confused as to date order

"Peter Blum" <PL****@Blum.in fo> wrote in message
news:<e1******* *******@TK2MSFT NGP14.phx.gbl>. ..
Several ideas:
1. Use the DateTime object included with .net (which is the underlying
code
to IsDate). Call its Parse or ParseExact methods. (See the .net docs for
details). They will throw exceptions when they cannot parse.

2. Seriously, use a validator! The CompareValidato r with
Operator=DataTy peCheck and Type=Date will do the job and provide
client-side
validation.

3. Use a third party date textbox that already has the functionality (and
so
much more, like a popup calendar). You can find them on www.asp.net
Control
Gallery, www.123aspx.com and www.411asp.net. I am the author of one,
"Peter's Date Package" (http://www.peterblum.com/datecontrols/home.aspx).
It
includes a popup calendar, keyboard filtering and reformatting, extended
validators, and time entry controls.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlu m.com
Creator of "Profession al Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Nita Raju" <ni*******@hotm ail.com> wrote in message
news:ON******** ******@tk2msftn gp13.phx.gbl...
> Hi,
>
> I have to validate a textbox for date without using the validation
> controls. So i had to use IsDate(). It's not working properly when i
> give
> "11//2004". When i enter the above date it returns true.
> What can i do about it??
>
> Regards,
> Nita
>
>
>

Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
4918
by: Vladislav | last post by:
Could somebody comment the folowing log from immediate panel: ? isdate("0A0-0002") True ? cdate("0A0-0002") 01/02/2000 I would expect the value "0A0-0002" as not date
2
1224
by: EP | last post by:
I just upgraded a V 6.0 app. to .Net. I keep getting an error from a simple IsDate statement. Basically checking to see if the value of a variable(vValue = "A2957") is a date example - If IsDate(vValue)=False then The error message is "A first chance exception of type 'System.FormatException' occurred in mscorlib.dll Additional...
4
4926
by: John A Grandy | last post by:
IsNumeric() and IsDate() are "leftovers" from the VB6 days ... looking forward, perhaps it would be better not to use them .... does anyone have suggestions on replacements ?
1
2255
by: Sebastian Santacroce | last post by:
Hi, I am trying to use IsDate where the application will use a format of Month/day/year however on a system that uses day/month/year then IsDate uses that system format setting when evaluating if its a valid date. I want IsDate to use Month/Day/Year when validating and so independently from the system date format. How can I do this? ...
2
4457
by: Oenone | last post by:
I'm having a couple of problems with the IsDate function in VB.net (.net framework v1.1). Having searched the web and usenet for others having the same problem, I've seen several posts from people reporting the same error as me, followed by various responses from others saying they can't recreate the problem. Well I think I know how to...
2
1508
by: z. f. | last post by:
Hi, i see in reflector in inner implementation of the Microsoft.VisualBasic.Information.IsDate function that looks like that: public static bool IsDate(object Expression) { if (Expression != null) { if (Expression is DateTime)
5
2404
by: Jack Russell | last post by:
Why does IsDate("01:01:0_") return true?? Thanks Jack Russell
19
5031
by: MDC | last post by:
Why does this return true: IsDate("ISometimesHateProgrammingMarch2005") Is there another way to verify that this is not a date?? Thanks in advance! MDC
1
5076
by: nlulla | last post by:
Hi I am trying to get all rows from a datatable where the first column F1 is a date, as this datatable is created of excel, i only want to deal with rows where the first column is having a date in it. For Each drow As DataRow In dt.Select("isdate(F1)") .....code here stripped off , but was to loop through all columns NEXT but i get...
0
7825
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8179
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7933
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8191
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3816
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3841
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1431
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1155
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.