IIS 7中的日期时间错误 [英] datetime error in iis 7
问题描述
我在c#asp.net Web应用程序中有一个屏幕,可在其中添加特定日期的新闻,也可以编辑这些日期.它在我的本地系统中也有效.但是在iis 7服务器中运行时显示datetime错误(使用sql我知道服务器中的短日期和长日期格式与本地系统不同.因此我在本地系统中更改了与iis中相同的日期格式,但仍然可以正常工作.我使用的代码如下所示:
字符串stringDate ="2012/11/19";
DateTime日期= Convert.ToDateTime(ff_SetDate(stringDate));
公共字符串ff_SetDate(字符串日期时间)
{
试试
{
string [] date = datetime.Split(''/'');
字符串DD = date [0];
字符串MM = date [1];
字符串YY = date [2];
字符串dt = DD +"/" + MM +"/" + YY;
return(dt);
}
catch(ex ex例外)
{
扔前;
}
}
I have screen in c# asp.net webapplication, where i add news on particular dates.And can edit those dates also.It workes in my local sytem.But shows datetime error when it was running in iis 7 server(Used sql database).And i knew that the short date and long date format in server was different from local system.So i changed date format in local system same as in iis.But still it is working properly.Code i used is shown below:
string stringDate="19/11/2012";
DateTime date = Convert.ToDateTime(ff_SetDate(stringDate));
public string ff_SetDate(string datetime)
{
try
{
string[] date = datetime.Split(''/'');
string DD = date[0];
string MM = date[1];
string YY = date[2];
string dt = DD + "/" + MM + "/" + YY;
return (dt);
}
catch (Exception ex)
{
throw ex;
}
}
推荐答案
更改托管服务器中的日期时间,然后确定.
change the datetime in hosted server,then its ok.
其中一个主要应用程序正在服务器中运行,取决于那种格式.不幸的是,我没有选择这样做
One of the main application is running in server which depends on that format.Unfortunately i dont have an option to do that
这篇关于IIS 7中的日期时间错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!