Date function not working in server 2008

Posted by Shoyebaziz123 under ASP.NET on 10/9/2012 | Points: 10 | Views : 778 | Status : [Member] | Replies : 0
Hi All,

i am using this format to get date in dd/MM/yyyy format

string str=DateTime.Now.ToString("dd/MM/yyyy");

output 09/10/2012

its working all of operating system correctly , but when i am using server 2008 (OS) it returns

then i am using a function to convert this date into m/d/y format ( for sql operation)

public static DateTime ConvertDate(string mDate)

string sDate = mDate.Replace("-", "/");
sDate = sDate.Replace(".", "/");
string[] dtparts = sDate.Split('/');
DateTime tDate = new DateTime

return tDate;
works fine for all OS , but not for server 2008
its making sql server not working properly while i am using DML operation,
i have also change the Region And Culture setting of Server 2008 in various format but there is an error ' Index was outside bound of array'

now what i have to do ?



(No response found.)

Login to post response