473,468 Members | 1,323 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

CurentCulture set to en-GB but dates are appearing in US format st

I am setting the current culture on the current thread in my global.asax.cs
application_start() event as follows:

System.Threading.Thread.CurrentThread.CurrentCultu re = new
System.Globalization.CultureInfo("en-GB");

In my default.aspx.cs I then set the text of a label from a datetime
variable like this:

lblDate.Text = DateTime.Now.ToUniversalTime().ToLongDateString();

But the date is formatted in United States format.

I am hosting on a US host, so I would expect the format to be US without
setting the CurrentCulture, but I am clearly setting that to UK formatting so
I thought the date should be formatted as such.

Do I need to do something differently?
--
Regards,

Phillip Johnson (MCSD For .NET)
PJ Software Development
www.pjsoftwaredevelopment.com
Feb 9 '08 #1
2 1808
On Feb 9, 3:16*pm, Phil Johnson
<PhilJohn...@discussions.microsoft.comwrote:
I am setting the current culture on the current thread in my global.asax.cs
application_start() event as follows:

System.Threading.Thread.CurrentThread.CurrentCultu re = new
System.Globalization.CultureInfo("en-GB");

In my default.aspx.cs I then set the text of a label from a datetime
variable like this:

lblDate.Text = DateTime.Now.ToUniversalTime().ToLongDateString();

But the date is formatted in United States format.

I am hosting on a US host, so I would expect the format to be US without
setting the CurrentCulture, but I am clearly setting that to UK formattingso
I thought the date should be formatted as such.

Do I need to do something differently?
--
Regards,

Phillip Johnson (MCSD For .NET)
PJ Software Developmentwww.pjsoftwaredevelopment.com
Hi Phillip,

either set the culture in Application_BeginRequest (instead the
Application_Start)
or use Globalization section in the web.config.

<globalization culture="en-GB" uiCulture="en-GB"...
Feb 10 '08 #2
Thanks for that,

I'm guessing that's because sessions run in a different thread to the
application?

As long as it works though, I'm happy :-)

--
Regards,

Phillip Johnson (MCSD For .NET)
PJ Software Development
www.pjsoftwaredevelopment.com
"Alexey Smirnov" wrote:
On Feb 9, 3:16 pm, Phil Johnson
<PhilJohn...@discussions.microsoft.comwrote:
I am setting the current culture on the current thread in my global.asax.cs
application_start() event as follows:

System.Threading.Thread.CurrentThread.CurrentCultu re = new
System.Globalization.CultureInfo("en-GB");

In my default.aspx.cs I then set the text of a label from a datetime
variable like this:

lblDate.Text = DateTime.Now.ToUniversalTime().ToLongDateString();

But the date is formatted in United States format.

I am hosting on a US host, so I would expect the format to be US without
setting the CurrentCulture, but I am clearly setting that to UK formatting so
I thought the date should be formatted as such.

Do I need to do something differently?
--
Regards,

Phillip Johnson (MCSD For .NET)
PJ Software Developmentwww.pjsoftwaredevelopment.com

Hi Phillip,

either set the culture in Application_BeginRequest (instead the
Application_Start)
or use Globalization section in the web.config.

<globalization culture="en-GB" uiCulture="en-GB"...
Feb 10 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Alejandro Scomparin | last post by:
FORMULACION, PREPARACION Y EVALUACION ECONOMICA Y FINANCIERA DE PROYECTOS DE TECNOLOGIA INFORMATICA (IT) en la UTN Inicia: 17 de Mayo. 19 hs Dirigido a Esta preparado para gerentes, jefes,...
0
by: Alejandro Scomparin | last post by:
FORMULACION, PREPARACION Y EVALUACION ECONOMICA Y FINANCIERA DE PROYECTOS DE TECNOLOGIA INFORMATICA (IT) en la UTN Inicia: 17 de Mayo. 19 hs Dirigido a Esta preparado para gerentes, jefes,...
1
by: gotzonen | last post by:
Wenas, Tengo un pequeño problema con una aplicacion en ASP.Net 2.0. Tengo que mostrar un report en una pagina en la que el usuario elige los parametros que quiere que se muestren, en concreto...
0
by: gandalf | last post by:
Con motivo del enorme esfuerzo realizado para visitar la ciudad argentina de Córdoba, participar en la Reunión del MERCOSUR, en la clausura de la Cumbre de los Pueblos en la histórica Universidad...
0
by: paulvz882 | last post by:
comprimes de acomplia en France commander acomplia en ligne aucune prescription acomplia canada soft en ligne +++ PERTE DE POIDS +++ PERTE DE POIDS +++ PERTE DE POIDS +++ + ACHETER DU ACOMPLIA...
0
by: jkjtjktjktjhktjk | last post by:
acheter du acomplia en ligne acomplia belgique suisse achat acomplia discret acomplia a vendre PERTE DE POIDS comprimes de acomplia canada acomplia belgique soft bon marche +++ PERTE DE POIDS...
0
by: micah879 | last post by:
acomplia belgique soft generique femme en termes de acomplia canada acomplia suisse citrate de Rimonabant acomplia au rabais au Canada acheter du acomplia acomplia belgique +++ PERTE DE POIDS...
0
by: jkjtjktjktjhktjk | last post by:
acheter du acomplia cinq acomplia par email PERTE DE POIDS en France acomplia canada soft en ligne acomplia belgique acomplia belgique bon marche acheter du acomplia en ligne sur internet +++...
0
by: gfjhrsghhdgh | last post by:
acomplia canada suisse achat acomplia Pro on acomplia canada a vendre acomplia canada aucune prescription comprimes de acomplia en France bon marche acheter votre acomplia citrate de Rimonabant bon...
0
by: sdgvfwe | last post by:
achat ampicillin canada a vendre comprimes de acheter ampicillin en France bon marche achat acheter ampicillin canada acheter ampicillin canada en ligne sur internet acheter ampicillin canada soft...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.