C# 4.0 使用应用程序\u BeginRequest方法更改日期格式

C# 4.0 使用应用程序\u BeginRequest方法更改日期格式,c#-4.0,datetime,date-format,C# 4.0,Datetime,Date Format,我想使用Application_BeginRequest方法更改所有系统的日期时间格式。 现在我用这个方法 protected void Application_BeginRequest(object sender, EventArgs e) { CultureInfo newCulture = (CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone(); newCul

我想使用Application_BeginRequest方法更改所有系统的日期时间格式。 现在我用这个方法

protected void Application_BeginRequest(object sender, EventArgs e)
    {
        CultureInfo newCulture = (CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
        newCulture.DateTimeFormat.ShortDatePattern = "dd/MM/yyyy hh:mm tt";

        Thread.CurrentThread.CurrentCulture = newCulture;

    }

我认为它应该像这样显示日期时间格式“03/11/2013 01:59 AM”,但实际上它是这样显示的“03/11/2013 01:59 AM 1:59:03 AM”。那么问题是什么

我解决了这个问题,并使用了以下方法

protected void Application_BeginRequest(object sender, EventArgs e)
    {
        CultureInfo newCulture = (CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();


        newCulture.DateTimeFormat.ShortDatePattern = "dd/MM/yyyy";
        newCulture.DateTimeFormat.LongTimePattern = "hh:mm tt";

        Thread.CurrentThread.CurrentCulture = newCulture;

    }