Reputation: 401
I have a problem. How can i set cultureinfo to date, when the date comes from database.
I have database, where is recorded date/time, when a request have arrived.
Now it displays it like this: 2/24/2013 5:41:12 PM
and i want it to display like this 5. toukokuuta 2013
. For more info about that format i want is here It's in line 68 (Finnish)
The code i already have:
<script language="VB">
Imports System
Imports System.Globalization
Imports System.Threading
Public Class FormatDate
Public Shared Sub Main()
Dim dt As DateTime = DateTime.Now
' Sets the CurrentCulture property to U.S. English.
Thread.CurrentThread.CurrentCulture = New CultureInfo("fi-FI")
' Displays dt, formatted using the ShortDatePattern
' and the CurrentThread.CurrentCulture.
Console.WriteLine(dt.ToString("d. MMMM'ta 'yyyy"))
End Sub
End Class
</script>
That code dosen't work for now. Here is the string, which i want to combine it:
<%# DataBinder.Eval(Container.DataItem, "pvmaika") %>
(that pvmaika is database value, it means datetime)
Upvotes: 1
Views: 471
Reputation: 98
In front of the page, where you have that
<%@ Page Culture="fi-FI" Language="VB" Debug="true" %>
.
Include Culture="fi-FI"
.
That will work!
Upvotes: 1