473,287 Members | 1,947 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

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 2767
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 CompareValidator with
Operator=DataTypeCheck 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****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Nita Raju" <ni*******@hotmail.com> wrote in message
news:ON**************@tk2msftngp13.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.info> wrote in message news:<e1**************@TK2MSFTNGP14.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 CompareValidator with
Operator=DataTypeCheck 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****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Nita Raju" <ni*******@hotmail.com> wrote in message
news:ON**************@tk2msftngp13.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 CompareValidator will follow the CultureInfo object defined on the
current thread of the page. For example, <@Page Culture="en-GB" >. But it
only supports the DateTimeFormatInfo.ShortDatePattern 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 DateTimeFormatInfo object and assign it to the
DateTextBox.xDateTimeFormatInfo property. See page 34 of the User's Guide.
Set the DateTimeFormatInfo.ShortDatePattern to "dd-MM-yyyy" and
DateTimeFormatInfo.DateSeparator = "-".
2. Set the xAllowMonthNames property to "Show"
3. Peter's Date Package includes its own validator, DateTextBoxValidator,
that will handle this unusual format. So use it for validation.

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

"Jeff Knuckey" <je**********@asggroup.com.au> wrote in message
news:63**************************@posting.google.c om...
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.info> wrote in message
news:<e1**************@TK2MSFTNGP14.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 CompareValidator with
Operator=DataTypeCheck 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****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Nita Raju" <ni*******@hotmail.com> wrote in message
news:ON**************@tk2msftngp13.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
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
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...
4
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
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...
2
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...
2
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 !=...
5
by: Jack Russell | last post by:
Why does IsDate("01:01:0_") return true?? Thanks Jack Russell
19
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
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...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.