MSDOTnet.org Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

convert string to date

 
Post new topic   Reply to topic    MSDOTnet.org Forum Index -> ASPNet
Author Message
Elliot



Joined: 12 Dec 2007
Posts: 5

PostPosted: Fri Dec 14, 2007 12:11 am    Post subject: convert string to date Reply with quote

How can to save a string("13/12/2007") in a field which datatype is date in
the table?

field["dob"] = xxx?

Archived from group: microsoft>public>dotnet>framework>aspnet
Back to top
View user's profile Send private message
Mark Rae [MVP]



Joined: 08 Aug 2007
Posts: 29

PostPosted: Thu Dec 13, 2007 5:18 pm    Post subject: Re: convert string to date Reply with quote

"Elliot" wrote in message @microsoft.com...

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


--
Mark Rae
ASP.NET MVP
http://www.markrae.net
Back to top
View user's profile Send private message
Mark Rae [MVP]



Joined: 08 Aug 2007
Posts: 29

PostPosted: Thu Dec 13, 2007 5:23 pm    Post subject: Re: convert string to date Reply with quote

"Mark Rae [MVP]" wrote in message @TK2MSFTNGP02.phx.gbl...

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


--
Mark Rae
ASP.NET MVP
http://www.markrae.net
Back to top
View user's profile Send private message
Elliot



Joined: 12 Dec 2007
Posts: 5

PostPosted: Fri Dec 14, 2007 6:43 am    Post subject: Re: convert string to date Reply with quote

Useful!
Thanks again.


"Mark Rae [MVP]" wrote in message #KnLYPIHA.536@TK2MSFTNGP06.phx.gbl...
> "Mark Rae [MVP]" wrote in message
> @TK2MSFTNGP02.phx.gbl...
>
>> 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);
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net

Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
Time convert Hello, I have a database that I have been querying from my visual basic program to take my access DB and convert it to excel. I use a multitude of SQL queries to get it to the format I desire, but i have a time column that has both the date and time withi

how to convert VB6 project without VB6 We have VB.NET 2002 but need to work on some code a client developed in VB6. We've been unable to upgrade their VB6 project due to some missing components (DAO350.DLL & and the Upgrade Wizard recommends that we install VB6 first before upg

convert HTML to Word doc I have this code that creates an HTML formatted document and I can open the document through Word. But I want the format to be truely MS Word (2003). Does anyone know how to do this? Here's my code that does the first conversion: xmlfile = "myfile.xml" x

Convert.ToDateTime using MM/yy format Suppose a user wants to allow entry of credit card expiration dates in the two digit year format of MM/yy. Conversion of the textual date (like 03/06) to a DateTime structure behaves unexpectedly when using Is this a bug in the ToDateT

How convert a base class into a subclass?? I have a class which inherits from The code is basically (property procs omitted for clarity): Public Class DataTable() Inherits Public Property SQL As String = "" End Class Now, i have a proc which given a SQL
Post new topic   Reply to topic    MSDOTnet.org Forum Index -> ASPNet All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group