locked
Change the culture of date in code behind. RRS feed

  • Question

  • User-2015242085 posted

    Hi

    How to change the culture of date in code behind?

    ReadOnly Property TimeZone() As String

    Get

    Return ConfigurationSettings.AppSettings("TimeZone")

    End Get

    End Property

    ReadOnly Property GetDay() As String

    Get

    Return DateTime.Now.AddHours(TimeZone()).ToString("D")

    End Get

    End Property

    Sunday, July 15, 2007 4:09 PM

Answers

  • User-158764254 posted

    try this:

            Dim d As Date = Date.Now
    
            Dim es As System.Globalization.CultureInfo = New System.Globalization.CultureInfo("es-AR")
            Dim de As System.Globalization.CultureInfo = New System.Globalization.CultureInfo("de-DE")
    
            Response.Write(d.ToString("D", es))
            Response.Write("<br />")
            Response.Write(d.ToString("D", de))
    
     
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, July 15, 2007 7:04 PM