473,396 Members | 1,970 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

globalization problem

hi,

I have an ASP.NET application with a piece of code that looks like this:

(it is a VB.NET snippet)

Thread.CurrentThread.CurrentCulture = New
CultureInfo(Session.Item("Culture").ToString)
Thread.CurrentThread.CurrentUICulture = New
CultureInfo(Session.Item("Culture").ToString)
Dim cultureSpecificDate As Date = Request.QueryString("date").Trim()
the QueryString object is a key-value collection type, (similar to a
hashtable). It is a NameValueCollection to be exact, but I believe that this
is not an important point.

Let say the string returned by Request.QueryString("date").Trim() is
"20/7/2004 0:00:00"

If the culture loaded at that time is: english then the Date object created
will contain a correct value which is 20/7/2004. But if the culture loaded
is a bit exotic, like the thai culture (which i believe follows a budhist
calendar type), the date object created will be 7/20/1461
That is a problem as later on that date will be used for some SQL commands
and look for that related to the date 20th of july 1461 which obviously does
not exist as the year is tottally different (543 years of difference).

Then I have 2 questions:
1. how can i solve this and always have the right date? (2004 for my SQL
stored procedure). Also I would like a generic solution that will work for
any culture. I would like to avoid any hardcoded date transformation.
2. 2004 in the thai calender correspond 2547 (2004 + 543 = 2547)
Then it seems that when the date object instance is created there is a
problem as it transform 2004 into 1461 (2004 -543 = 1461), which basically
is wrong.

Best regards and tx in advance,

Francois




Jul 21 '05 #1
0 1089

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

Similar topics

3
by: Xavier MT | last post by:
Hi, I have a site that has some text in spanish and it doesn't display well, for example with a ń it displays some weird boxes, can anyone help me or point me to some help
0
by: FM | last post by:
Hi, I use the following code to set the current culture. If Not IsNothing(Session("language")) Then System.Threading.Thread.CurrentThread.CurrentCulture = New...
4
by: FM | last post by:
Hi, I use the following code to set the current culture. If Not IsNothing(Session("language")) Then System.Threading.Thread.CurrentThread.CurrentCulture = New...
11
by: Cor Ligthert | last post by:
Hello everybody, Jay and Herfried are telling me every time when I use CDate that using the datetime.parseexact is always the best way to do String to datetime conversions. They don't tell why...
0
by: Sparkiee | last post by:
Hi, A lil bit of help required from you guys, I am trying to make a windows service that will also focus on globalization, the problem i am facing is when i am trying to put globalization code in...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.