473,385 Members | 1,409 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,385 software developers and data experts.

equivalent of isdate in C#.net

375 256MB
Hi, All

We have a function called IsDate in Visual Basic that will determine if the given string is date or not.

Do we have any such function in C#.

Regards
cmrhema
Jul 11 '08 #1
4 14619
Hi,
You can use Datetime.Tryparse method
DateTime date1
if (!(DateTime.TryParse(txtDate.Text, out date1)))
{
lblMessage.Text = "Enter correct date !";
return;
}
else
{
//do the task
}
Jul 11 '08 #2
cmrhema
375 256MB
Hi,
You can use Datetime.Tryparse method
DateTime date1
if (!(DateTime.TryParse(txtDate.Text, out date1)))
{
lblMessage.Text = "Enter correct date !";
return;
}
else
{
//do the task
}

Thanks a million, was looking for this for quite a long time
Jul 11 '08 #3
Thanks a million, was looking for this for quite a long time
u r welcome. I am happy that this time i can help u.
Jul 11 '08 #4
Plater
7,872 Expert 4TB
Thanks a million, was looking for this for quite a long time
Pretty much every basic type (int,float,datetime) has the .Parse() function (and most have .TryParse())
Jul 11 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: DTB | last post by:
I am having trouble creating an INSTEAD OF trigger in SQL Server to replicate a BEFORE UPDATE trigger from ORACLE. Here is a sample of the ORACLE BEFORE UPDATE trigger: CREATE TRIGGER myTRIGGER ON...
3
by: Mike | last post by:
Hi, Anyone knows what the equivalent of the IsDate function is in C#? Thanks Mike
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
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.