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 / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

convert string to date

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Elliot - 13 Dec 2007 11:11 GMT
How can to save a string("13/12/2007") in a field which datatype is date in
the table?

field["dob"] = xxx?
Mark Rae [MVP] - 13 Dec 2007 12:18 GMT
> How can to save a string("13/12/2007") in a field which datatype is date
> in the table?
>
> field["dob"] = xxx?

field["dob"] = Convert.ToDateTime("13/12/2007");
field["dob"] = DateTime.Parse("13/12/2007");
field["dob"] = ParseExact("13/12/2007", "dd/MM/yyyy", null);

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

Mark Rae [MVP] - 13 Dec 2007 12:23 GMT
> field["dob"] = ParseExact("13/12/2007", "dd/MM/yyyy", null);

Apologies - slip of the Enter key...

field["dob"] = DateTime.ParseExact("13/12/2007", "dd/MM/yyyy", null);

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

Elliot - 13 Dec 2007 17:43 GMT
Useful!
Thanks again.

>> field["dob"] = ParseExact("13/12/2007", "dd/MM/yyyy", null);
>
> Apologies - slip of the Enter key...
>
> field["dob"] = DateTime.ParseExact("13/12/2007", "dd/MM/yyyy", null);

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.