How to determine a string is in valid dateTime format

G

Guest

Hello, friends,

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

Thanks a lot.
 
A

Alex Meleta

DateTime.TryParse() and such.

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

-----Original Message-----
From: Andrew [mailto:[email protected]]
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.
 
G

Guest

Thank you guys. I used DateTime.TryParse().

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

Thanks again.
 
A

Aleksander Polak

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);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top