Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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;
}
}
Posted
Updated 18-Nov-12 19:33pm
v2
Comments
Sergey Alexandrovich Kryukov 19-Nov-12 0:54am    
We don't have access to your computer, no we have access to the host of the IIS server. Got the hint?
--SA

change the datetime in hosted server,then its ok.
 
Share this answer
 
One of the main application is running in server which depends on that format.Unfortunately i dont have an option to do that
 
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