Windows SERVER 2008 R2日期时间格式问题 [英] Windows SERVER 2008 R2 Datetime Format Problem
问题描述
对于我的ASP.Net Web应用程序,当我使用"Visual Studio"运行时,它显示日期格式,如"dd/MM/yyyy"(我需要)
但是在IIS中配置它之后,它会显示"dd-MM-yyyy"之类的日期(我不需要)
如何为我的asp.net应用程序全局设置这些数据时间格式?
甚至我尝试在应用程序中使用"Global.asax"文件来更改"datetime cultureinfo",但没有用.
即使我更改ControlPanel->区域和语言设置.还是没有运气..
我在asp.net应用程序中将今天的日期指定为
txt_jobdate.Text = DateTime.Now.ToString("dd/MM/yyyy");
For my ASP.Net web application, while i run using "Visual Studio" it displays date format like ''dd/MM/yyyy''(Which i need)
But after configuring it in IIS it displays date like ''dd-MM-yyyy''(which i don''t need)
How to set these datatime format globally for my asp.net application ??
Even i tried to use "Global.asax" file inside my application to change "datetime cultureinfo" but no use.
Even i change ControlPanel-->Regional and Language settings. No luck still..
I assigned todays date in my asp.net application as
txt_jobdate.Text = DateTime.Now.ToString("dd/MM/yyyy");
Its works perfect while compile but not after i publish it.
推荐答案
您可以在web.config文件中设置区域性.
http://msdn.microsoft.com/en-us/library/bz9tc508.aspx [ ^ ]
本文显示了另一种方法...
http://stackoverflow.com/questions/2468312/setting-a-date-format-in-asp-net-web-config-globalization-tag [
You can set your culture in web.config file.. follow the article.
http://msdn.microsoft.com/en-us/library/bz9tc508.aspx[^]
this article shows a different approch...
http://stackoverflow.com/questions/2468312/setting-a-date-format-in-asp-net-web-config-globalization-tag[^]
mark as answer if solves your problem... :)
这篇关于Windows SERVER 2008 R2日期时间格式问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!