Click here to Skip to main content
12,508,996 members (57,933 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# ASP.NET
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 18-Nov-12 18:26pm
Updated 18-Nov-12 19:33pm
v2
Comments
   
We don't have access to your computer, no we have access to the host of the IIS server. Got the hint?
--SA
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

change the datetime in hosted server,then its ok.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

One of the main application is running in server which depends on that format.Unfortunately i dont have an option to do that
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160927.1 | Last Updated 19 Nov 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100