Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / September 2007

Tip: Looking for answers? Try searching our database.

dates

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DaveP - 15 Sep 2007 22:58 GMT
how to validate a date type
is there a isdate() function in c#
or do i write my own

DaveP
Peter Duniho - 15 Sep 2007 23:04 GMT
> how to validate a date type
> is there a isdate() function in c#
> or do i write my own

What date type?  DateTime?  A DateTime instance is always a valid date
and time, though it may fall outside of some range you require.

Or do you mean you want to validate a string to verify it represents an
actual date?  You could use DateTime.TryParse() to do that, though of
course there are a wide variety of strings that a human could recognize
as a date but which would fail to be parsed.  Still, using TryParse()
should give you results useful in a computer program.  :)

Pete
Arne Vajhøj - 15 Sep 2007 23:05 GMT
> how to validate a date type
> is there a isdate() function in c#
> or do i write my own

What are you looking for ?

A DateTime type is a DateTime type.

Are you looking to test whether a string contains
a valid date according to either standard formats
or a custom format ?

If that is the case try look at DateTime Parse and
ParseExact methods (or TryParse and TryParseExact).

Arne
DaveP - 15 Sep 2007 23:57 GMT
thats what i used is datetime.parse()
so much in .net....wasn't sure if there was a function out there somewhere

Thank you much
DaveP

>> how to validate a date type
>> is there a isdate() function in c#
[quoted text clipped - 12 lines]
>
> Arne
Arne Vajhøj - 16 Sep 2007 22:10 GMT
> thats what i used is datetime.parse()
> so much in .net....wasn't sure if there was a function out there somewhere

If you use a non standard format then you may need the Exact variants.

Arne

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.