X
xenophon
I am trying to format datetime output with an HTTP Module. Right now
dates are displaying in US format like "MM/DD/YYYY 12:00:00". I want
to change the output to "MM/DD/YYYY" if US or "DD.MM.YYYY" if German,
etc. My HTTP Module code below does not seem to affect the output of
my datagrid with Datetime values in it, no matter what language I put
at the top of my IE browser's language list. Can anyone say how I can
make this better?
public class CultureFilter : IHttpModule
{
public CultureFilter()
{
}
public void Init(HttpApplication httpApplication)
{
try
{
if (HttpContext.Current.Request.UserLanguages.Length > 0)
{
Thread.CurrentThread.CurrentCulture =
CultureInfo.CreateSpecificCulture(
HttpContext.Current.Request.UserLanguages[0] );
}
}
catch (ArgumentException xxxArg )
{
string oops = xxxArg.ToString();
}
}
public void Dispose()
{
}
#endregion
}
Thanks.
dates are displaying in US format like "MM/DD/YYYY 12:00:00". I want
to change the output to "MM/DD/YYYY" if US or "DD.MM.YYYY" if German,
etc. My HTTP Module code below does not seem to affect the output of
my datagrid with Datetime values in it, no matter what language I put
at the top of my IE browser's language list. Can anyone say how I can
make this better?
public class CultureFilter : IHttpModule
{
public CultureFilter()
{
}
public void Init(HttpApplication httpApplication)
{
try
{
if (HttpContext.Current.Request.UserLanguages.Length > 0)
{
Thread.CurrentThread.CurrentCulture =
CultureInfo.CreateSpecificCulture(
HttpContext.Current.Request.UserLanguages[0] );
}
}
catch (ArgumentException xxxArg )
{
string oops = xxxArg.ToString();
}
}
public void Dispose()
{
}
#endregion
}
Thanks.