Search

Tuesday, April 7, 2009

Globlization Localization Date

"public DateTime CultureDate(string dat)
{
DateTime condate;
string[] dt = dat.Split('/');
CultureInfo cul = CultureInfo.CurrentCulture;
if (cul.ToString() == 'en-US')
{
return condate = Convert.ToDateTime(dt[1] + '/' + dt[0] + '/' + dt[2]);
}
else if (cul.ToString() == 'en-UK')
{
return condate = Convert.ToDateTime(dt[0] + '/' + dt[1] + '/' + dt[2]);
}
else
{
return condate = Convert.ToDateTime(dt[0] + '/' + dt[1] + '/' + dt[2]);
}
}"

No comments:

Blog Archive

Contributors