Click here to Skip to main content
15,907,326 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear sir/Mam


I am Shailendra Singh and I am new to .Net .how to convert date and time nvarchar to DATE and TIME data-type ASP.NET(c#).Any one help me.






Thanks In Advance
Posted
Comments
Richard MacCutchan 17-Oct-11 7:21am    
Don't store dates or times as nvarchar but as date/time values.
Amir Mahfoozi 17-Oct-11 8:26am    
Sometimes in unsupported calendar systems they have to do that.
Richard MacCutchan 17-Oct-11 11:57am    
So why would they want to convert it back to a DateTime?

string strDate="10/17/2011"
DateTime dt=DateTime.Parse(strDate.ToString());
 
Share this answer
 
1. DateTime.ParseExact(yourcontrol, "MM/dd/yyyy", CultureInfo.InvariantCulture);
2. Convert.ToDateTime(yourcontrol.Text.Trim());
 
Share this answer
 
string date = "01/08/2008";
DateTime dt = Convert.ToDateTime(date);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900