I work on asp.net MVC application .NET application . I get error input
string not in correct format with date and time when publish application
over IIS but on local machine not get any error
I search for that I found that error on datetime on the line below
if (Session[SessionKeys.VisaExpiryDate] == null)
{
visaExpiryDate = 0;
}
else
{
DateTime visDateExpire = Convert.ToDateTime(Session[SessionKeys.VisaExpiryDate]);
visaExpiryDate = JulianDate.DateTimeToJulian(visDateExpire);
}
for details function as below :
public static int DateTimeToJulian(DateTime dateTime)
{
string szDate = string.Empty;
int nPrefix = 0;
int nSufix = 0;
nPrefix = (Convert.ToInt32(dateTime.Year.ToString().Substring(1, 1) + "00") + 100) + Convert.ToInt32(dateTime.Year.ToString().Substring(2, 2));
nSufix = dateTime.DayOfYear;
szDate = nPrefix.ToString() + nSufix.ToString("000");
if (szDate.Length > 6)
szDate = szDate.Substring(1, 6);
return Convert.ToInt32(szDate);
}
error say input string not in correct format with datetime
so How to solve this error to work on server ?
In your previous question it was pointed out to you that there is built in support for the Julian calendar – why are you not using that?