ASP.NET Application is displaying american date formats

女生的网名这么多〃 提交于 2019-12-02 01:29:31

The windows regional settings does not affect any website, unless the website is programmed to get the regional settings from the browser preferred languages and apply them to the ASP site

Use the globalization option in the web.config

<globalization culture="es-AR" uiCulture="es" />

OR

Set the value in the global.aspx Application_BeginRequest method

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
    Dim lang As String = "es"
    If HttpContext.Current.Request.Path.Contains("/en/") Then
        lang = "en"
    ElseIf HttpContext.Current.Request.Path.Contains("/pt/") Then
        lang = "pt"
    ElseIf HttpContext.Current.Request.Path.Contains("/es/") Then
        lang = "es"
    End If
    Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(lang)
    Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(lang)
End Sub

From MSDN

The value of the current DateTime object is formatted using the pattern defined by the DateTimeFormatInfo.ShortDatePattern property associated with the current thread culture. The return value is identical to the value returned by specifying the "d" standard DateTime format string with the ToString(String) method.

Have you tried changing the culture for the current thread? This can be set on a per page basis as well - http://msdn.microsoft.com/en-us/library/bz9tc508%28v=vs.85%29.aspx.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!