Click here to Skip to main content
15,918,193 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have string like '12/13/2012' now i want to convert this string to date format like '12/13/2012 00:00:00' this.
When i use
DateTime dt = Convert.ToDateTime("12/13/2012");

it returns '12/13/2012 12:00:00'

How can i get the date like '12/13/2012 00:00:00'

kindly help

dt.ToString("MM/dd/yyyy HH:mm:ss");
Share this answer
Vishal.Shimpi144 13-Dec-12 1:01am    
this solution will return string and i want datetime
__TR__ 13-Dec-12 1:08am    
The time value in your datetime object is set to 12:00:00 AM (midnight). You are converting it to string to display it in 24 hour format.
You could always do it as below...
CType(Today.Date & " 00:00:00", DateTime)

Obviously replace "" with the date you want to use
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