473,470 Members | 1,920 Online
Bytes | Software Development & Data Engineering Community
Create 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 2773
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: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.