Hi Niclas,
I think you want to apply the cultureinfo to the thread to be sure it is
formatted for GB. Try the code below and let us know if it helps?
Ken
Microsoft MVP [ASP.NET]
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub Page_Load _
(ByVal sender As Object, _
ByVal e As System.EventArgs)
System.Threading.Thread.CurrentThread.CurrentCultu re = _
New Globalization.CultureInfo("en-GB")
System.Threading.Thread.CurrentThread.CurrentUICul ture = _
New Globalization.CultureInfo("en-GB")
TextBox1.Text = Now.ToShortDateString
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Short date in UK format</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:textbox id="TextBox1" runat="server"></asp:textbox></div>
</form>
</body>
</html>
"Niclas" <li*************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hi,
I want to display a date in UK format (dd/MM/yyyy) and am using a culture
info object for this. using
Convert.ToString(MyDate, _CultInfo)
works fine, besides that the string includes the time as well.
I have tried using
Convert.ToString(MyDate.ToshortDatestring, _CultInfo)
But this will format the date with US format
Any ideas on how to display a short date formatted string in UK format ?
Niclas