Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Globalization and Convert()
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01666018
Message ID:
01666087
Views:
33
Thank you for the link to your blog.

>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.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform