Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Date time format problem in c#

Tags:

c#

datetime

Hi I'm working with c# simple application to display system date time.

textbox.Text = DateTime.Now.ToString("MM/dd/yyyy");

but it is showing result as : 05-12-2010

What is the problem with this code? or do I need to change any where in the regional settings of my machine.

thank you

like image 411
jestges Avatar asked May 12 '10 11:05

jestges


People also ask

What does Strftime mean in C?

strftime() is a function in C which is used to format date and time. It comes under the header file time. h, which also contains a structure named struct tm which is used to hold the time and date.


1 Answers

the "/" represents the locale datetime seperator. Im guessing that

DateTime.Now.ToString(@"MM\/dd\/yyyy");

will do what you want.

http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx

like image 111
hhravn Avatar answered Sep 21 '22 11:09

hhravn