[pass parameters date, language and country and output local datetime]
public static string How2GetLocalizedDate(string INdate, string INlanguage, string INcountry)
{
if ((!string.IsNullOrEmpty(INdate)) && ((!string.IsNullOrEmpty(INlanguage))) && (!string.IsNullOrEmpty(INcountry)))
{
DateTime dt = DateTime.Parse(INdate);
// Sets the CurrentCulture property to U.S. English.
Thread.CurrentThread.CurrentCulture = new CultureInfo(INlanguage + "-" + INcountry);
// Displays dt, formatted using the ShortDatePattern
// and the CurrentThread.CurrentCulture.
return dt.ToLongDateString();
}
else
{
return "";
}
}
public static string How2GetLocalizedDate(string INdate, string INlanguage, string INcountry)
{
if ((!string.IsNullOrEmpty(INdate)) && ((!string.IsNullOrEmpty(INlanguage))) && (!string.IsNullOrEmpty(INcountry)))
{
DateTime dt = DateTime.Parse(INdate);
// Sets the CurrentCulture property to U.S. English.
Thread.CurrentThread.CurrentCulture = new CultureInfo(INlanguage + "-" + INcountry);
// Displays dt, formatted using the ShortDatePattern
// and the CurrentThread.CurrentCulture.
return dt.ToLongDateString();
}
else
{
return "";
}
}