Click here to Skip to main content
16,004,782 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
how to separate date and time in windows form application using visual studio 2008?
Posted
Updated 22-Sep-10 19:52pm
v2

Hi,

Do the following
C#
string Date = DateTime.Now.ToString("dd-MM-yyyy");
string Time = DateTime.Now.ToString("hh:mm:ss");



Please do let me know, if you have any doubt.

Please provide "Vote" if this would be helpful, and make "Accept Answer" if this would be correct answer.

Thanks,
Imdadhusen
 
Share this answer
 
You could use this small snippet to solve your small problem.

MIDL
DateTime Dt = new DateTime(2010, 10, 10, 12, 22, 32);
String Date = Dt.ToString("dd-MM-yyyy");
String Time = Dt.ToString("hh:mm:ss");
 
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