473,836 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IsDate function is Vb.Net

IsDate("01/01") in Vb.Net is returning TRUE. Is it a bug in the function?
What is the other way of checking the same functionality? Is there any other
know issue with the date function.
..Net 1.1 Framework.
I know alternative way of checking the same "If TypeOf MyVariable Is
DateTime Then"
Thanks,
Smith
Nov 21 '05 #1
6 25894
"Peter Smith" <Pe*********@ho tmail.com> schrieb
IsDate("01/01") in Vb.Net is returning TRUE. Is it a bug in the
function? What is the other way of checking the same functionality?
Is there any other know issue with the date function.
.Net 1.1 Framework.
I know alternative way of checking the same "If TypeOf MyVariable Is
DateTime Then"

I don't see a bug. It is a valid date. It's the first of January. The year
is 2005 because it is not specified.
Armin

Nov 21 '05 #2
Then what about this?
IsDate("01/2005"). This is also january first 2005?
Thanks,
Smith
"Armin Zingler" <az*******@free net.de> wrote in message
news:uI******** ******@TK2MSFTN GP14.phx.gbl...
"Peter Smith" <Pe*********@ho tmail.com> schrieb
IsDate("01/01") in Vb.Net is returning TRUE. Is it a bug in the
function? What is the other way of checking the same functionality?
Is there any other know issue with the date function.
.Net 1.1 Framework.
I know alternative way of checking the same "If TypeOf MyVariable Is
DateTime Then"

I don't see a bug. It is a valid date. It's the first of January. The year
is 2005 because it is not specified.
Armin

Nov 21 '05 #3
In article <ut************ **@TK2MSFTNGP14 .phx.gbl>, Peter Smith wrote:
IsDate("01/01") in Vb.Net is returning TRUE. Is it a bug in the function?
What is the other way of checking the same functionality? Is there any other
know issue with the date function.
.Net 1.1 Framework.
I know alternative way of checking the same "If TypeOf MyVariable Is
DateTime Then"
Thanks,
Smith


As Armin suggests, this is not a bug. Most likely, though I haven't
really bothered to check, the IsDate function most is a wrapper
for the DateTime.Parse function. And, if you read the remarks on this
function in the documentation, I would expect this behavior.

Basically, it says that the DateTime.Parse function uses the information
in the DateTimeFormatI nfo for the current culture. As it parses, it
will FILL in any missing values (month, day, year) with the
values from the current date... Meaning that, the DateTime.Parse will
turn your string:

"01/01" into a date of "01/01/05". And that, is a valid date.

--
Tom Shelton [MVP]
Nov 21 '05 #4
In article <u6************ **@TK2MSFTNGP12 .phx.gbl>, Peter Smith wrote:
Then what about this?
IsDate("01/2005"). This is also january first 2005?
Thanks,
Smith


See my previous post... Esentially, DateTime.Parse will interpret that
as January 20, 2005 (basically, adding todays day in). Again, it will
return a valid date, so the IsDate Function will return true.

--
Tom Shelton [MVP]
Nov 21 '05 #5
In article <ut************ **@TK2MSFTNGP14 .phx.gbl>, Peter Smith wrote:
IsDate("01/01") in Vb.Net is returning TRUE. Is it a bug in the function?
What is the other way of checking the same functionality? Is there any other
know issue with the date function.
.Net 1.1 Framework.
I know alternative way of checking the same "If TypeOf MyVariable Is
DateTime Then"
Thanks,
Smith


One more note... If this is a problem for you - you could always write a
replacement using DateTime.ParseE xact. ParseExact will only return a
date if the date is in the specified format. So, in psuedo code it
would look something like:

public function myIsDate (date as string) as boolean
try
datetime.parsee xact (....)
return true
catch
return false
end try
end fuction

--
Tom Shelton [MVP]
Nov 21 '05 #6
"Peter Smith" <Pe*********@ho tmail.com> schrieb
Then what about this?
IsDate("01/2005"). This is also january first 2005?


Yes:
Msgbox CDate("01/2005")

Tom's reply answers why.

If you don't like the flexibilty of the function - you are not the only
one - you can write one on your own (or find one for free).
Armin

Nov 21 '05 #7

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

Similar topics

0
1548
by: vonclausowitz | last post by:
Hi All, I use IsDate() to check a field in Outlook tasks to see if it contains a real date. If IsDate(Task.role) then ... else ... endif
3
8125
by: Mike | last post by:
Hi, Anyone knows what the equivalent of the IsDate function is in C#? Thanks Mike
0
1243
by: Veeresh | last post by:
I am using ISDate function to determine whether user has entred valid date or not. The below statement returns true. IsDate("12/12") is true & the system interprets this as 12/12/2004. Is there any other function to check valid date in a editbox? Veer
2
3427
by: John | last post by:
Hi all, How do I use the isDate function? The reason I ask this is because the function returns a false for a date "13/09/2004" which is correct in "dd/MM/yyyy" format. Is there another function I can use to validate a simple string in "dd/MM/yyyy" format? Any help appreciated.
3
1567
by: Andy Holliman | last post by:
Why does IsDate("01 02 03 12 2003") return true and CDate("01 02 03 12 2003") return "1 12 2003" ? Thanks Andy
2
4471
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 recreate it, but I still don't understand why it's occurring. Does anyone have any ideas? Try the...
2
1519
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)
19
5055
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
5092
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 following error when i run the above code "The expression contains undefined function call isdate()"
0
9656
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10527
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10241
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9358
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7774
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5642
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5812
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4443
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3102
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.