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 / .NET Framework / New Users / April 2007

Tip: Looking for answers? Try searching our database.

How to determine a string is in valid dateTime format

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andrew - 18 Apr 2007 21:20 GMT
Hello, friends,

What is the best way to determine a string is in valid dateTime format?

Thanks a lot.
Scott M. - 18 Apr 2007 21:34 GMT
Try casting it to a DateTime inside of a try...catch?  Use RegEx?

> Hello, friends,
>
> What is the best way to determine a string is in valid dateTime format?
>
> Thanks a lot.
Alex Meleta - 18 Apr 2007 21:38 GMT
DateTime.TryParse() and such.

WBR, Alex Meleta
Blog: http://devkids.blogspot.com

-----Original Message-----
From: Andrew [mailto:Andrew@discussions.microsoft.com]
Posted At: Donnerstag, 19. April 2007 00:20
Posted To: microsoft.public.dotnet.framework
Conversation: How to determine a string is in valid dateTime format
Subject: How to determine a string is in valid dateTime format

Hello, friends,

What is the best way to determine a string is in valid dateTime format?

Thanks a lot.
Andrew - 18 Apr 2007 22:52 GMT
Thank you guys. I used DateTime.TryParse().

Also, another question: How to quickly convert a collection into an array?

Thanks again.
Aleksander Polak - 18 Apr 2007 23:21 GMT
> Also, another question: How to quickly convert a collection into an array?

It depends on the collection. ArrayList and List<T> have a parameterless
ToArray method, which creates an array containing elements from the
collection. In addition, ICollection and ICollection<T> exposes a CopyTo
method, which can be used in the following manner:

Widget[] arr = new Widget[coll.Count];
coll.CopyTo(arr, 0);

Signature

Aleksander Polak


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.