Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
DateTime dt1 = Convert.ToDateTime(txtBxDay.Text.ToString());
DateTime dt2 = Convert.ToDateTime(txtBxTime.Text);



txtByDay.Text is Date datatype and I couldn't convert to datetime. Same case for time...
Is there any format to fetch date and convert to DATETIME and fetch time(time datatype) and convert to DATETIME and adding two values as DATETIME....
Posted
Comments
Azee 12-Oct-13 1:00am    
What is the error that system shows?
Sergey Alexandrovich Kryukov 12-Oct-13 1:22am    
You have no clue on what you are doing. Text is already a string, no need to call ToString.
And how can we know what's in that text?
And use Parse, TryParse, ParseExact or TryParseExact instead.
—SA

1 solution

I think the dat format is incorrect .When you covert Datetime mean the format is(MM/dd/yyyy) Othewise you can not use Datetime datatype
 
Share this answer
 
v2

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