Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Globalization and Convert()
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01666018
Message ID:
01666085
Vues:
47
All the localization features in ASP.NET depend on the currently active CultureInfo so any parsing of dates you use use the active Culture.

If you need to switch to different locales, you have a few choices:

* Use localization to switch to the user's locale

There's more info in this blog post:

Auto Selecting Cultures for Localization in ASP.NET

Specifically look at the section: Auto-selecting culture with code. Basically you can sniff the browser's locale and based on that you can perhaps perform the conversion by switching the thread's culture, doing the conversion and shifting it back.

+++ Rick ---

>Hi,
>
>I have a code in my ASP.NET application that shows a date field using the Convert() function, as follows:
>
>Convert(varchar(11), DATE_FLD,111)
>
>The above shows the date as YYYY/MM/DD American customers are happy.
>
>For my euro customer I need to show this date as DD/MM/YYYY Which I can do if I change the last parameter of Convert() from 111 to 103.
>
>But how would you suggest I do it so that I don't have a custom version for one (euro) customer? All other dates of the application are ok based on the Globalization tag in the web.config. This has a setting of
>
>uiCulture="en" culture="en-GB"
>
>
>But the Convert() is a problem.
>
>Any suggestions?
>
>UPDATE. The above Convert() is used in the SQL Select as follows:
>
>select 'Processed on ' + Convert(varchar(11), DATE_FLD,111) from MyFile
>
>
>If there were a different function (other than Convert()) to show the date as a string, and that would respect the Globalization tag, it would resolve my issue.
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform