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

I am assigning date in a TextBox datetime.now.ToString("dd/MM/yyyy") from .cs Page, but it shows "12-06-2014" after running the page. It create problem due to my required format("dd/MM/yyyy") .

As I have set my System Date Format("dd/MM/yyyy").

Please solve my problem.
Posted
Comments
LebneizTech 27-Feb-15 9:26am    
Also my .css file do not work properly in Windows 7, and work properly in Win-XP,Win 2008.
Only in Windows 7 create problem.

1 solution

That's easy, man, use the Force (just kidding). It can be done like this:
C#
DateTime.Now.ToString("dd'/'MM'/'yyyy")

You can read more here.
 
Share this answer
 
Comments
LebneizTech 27-Feb-15 9:01am    
Sir Ji,
it is working in Windows XP, Windows 2008, but not in Windows 7.There is no issue of Syntax.
Vladimir Svyatski 27-Feb-15 10:04am    
Have you noticed that I surrounded slashes in the format string with quotes? That's the important difference from your code. It works perfectly fine on my machine with Windows 8.1 and my default locale is not en-US. Another option is to use this overload. Use CultureInfo("en-US") as IFormatProvider.

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