473,394 Members | 1,718 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,394 software developers and data experts.

Problems with toShortDateString

Hi!

I'm migrating a web application (ASP.NET) from Framework 1.1 to
Framework 2.0.

I have a problem with that, and I didn't found a solution changing
something in web.config or something like that.

The problem is that when using Framework 1.1, the function
toShortDateString, returns a string with a date at machine culture (in
my case, in spanish). When using Framework 2.0, this function always
returns a string with a date in English culture. The application it
functions depending of the server culture and the user culture, and
when the functions returns always in English, the application don't
works.

I tried to force culture at web.config and change the culture of the
thread in Global.asax, but with no results.

Do you know if this is a bug of Framework 2.0 and if there is a
solution for that? The only thing I know for fix this, is to modify all
the code in the application.

Thanks in advance

Jesus

Jul 27 '06 #1
2 2993
Docs state

DateTime.ToShortDateString Method
(http://msdn2.microsoft.com/en-us/lib...atestring.aspx)
*
The value of this instance is formatted using the short date format
character, 'd'. The return value is identical to the value returned by
ToString ("d", null).
For more information about format characters, format patterns, and the
output they produce, see the Formatting Overview topic. For more information
about changing the format pattern associated with a format character see the
DateTimeFormatInfo class.

This method uses formatting information derived from the current culture.
For more information about the current culture, see the CurrentCulture
class. You can use the CultureInfo.DateTimeFormat property to obtain the
DateTimeFormatInfo for the current culture.

*
And with ASP.NET you can change these in <globalizationelement in
web.config.
--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

"Jesus" <ma**********@gmail.comwrote in message
news:11*********************@h48g2000cwc.googlegro ups.com...
Hi!

I'm migrating a web application (ASP.NET) from Framework 1.1 to
Framework 2.0.

I have a problem with that, and I didn't found a solution changing
something in web.config or something like that.

The problem is that when using Framework 1.1, the function
toShortDateString, returns a string with a date at machine culture (in
my case, in spanish). When using Framework 2.0, this function always
returns a string with a date in English culture. The application it
functions depending of the server culture and the user culture, and
when the functions returns always in English, the application don't
works.

I tried to force culture at web.config and change the culture of the
thread in Global.asax, but with no results.

Do you know if this is a bug of Framework 2.0 and if there is a
solution for that? The only thing I know for fix this, is to modify all
the code in the application.

Thanks in advance

Jesus

Jul 27 '06 #2

Hi!

Thanks for your answer, Teemu.

This is the how I think this function may work, but it isn't.

If you read this, the function ToShortDateString must return an
string converting a date with the culture of the machine.

This is how it works in ASP.NET 1.1, but in .NET 2.0, this function
always returns an string in format mm/dd/yyyy, even if I change the
culture of the server or the Internet Explorer.

I supose that this is a bug of .NET 2.0, because if I do the same
test in a Win32 Application, it works fine.

If you can show me other way to search, I will be thankful forever.
:-)

Thanks in advance

Jesús

Teemu Keiski ha escrito:
Docs state

DateTime.ToShortDateString Method
(http://msdn2.microsoft.com/en-us/lib...atestring.aspx)
*
The value of this instance is formatted using the short date format
character, 'd'. The return value is identical to the value returned by
ToString ("d", null).
For more information about format characters, format patterns, and the
output they produce, see the Formatting Overview topic. For more information
about changing the format pattern associated with a format character see the
DateTimeFormatInfo class.

This method uses formatting information derived from the current culture.
For more information about the current culture, see the CurrentCulture
class. You can use the CultureInfo.DateTimeFormat property to obtain the
DateTimeFormatInfo for the current culture.

*
And with ASP.NET you can change these in <globalizationelement in
web.config.
--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
Jul 28 '06 #3

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

Similar topics

9
by: Eva | last post by:
Hi, I wanted to know how i can enter values into a specific column of a listview. I have tried the following code but this seems to enter all my values into the first column!!! Can anyone...
0
by: Nugnet | last post by:
Hi, I have an ASP.NET web application that I want to be locale sensitive. I set my regional options to be English (United States) and rebooted my machine (normally have English(United Kingdom...
0
by: Brian Conway | last post by:
I am having some validation and insertion problems. I am using a date picker that takes the selected date and puts it to ("dd-MMM-yyyy") format, as this was the only format that Oracle would...
9
by: Jozef Jarosciak | last post by:
I have an application which imports fields from external source where date format of one the collumns is English (United States): M/d/yyyy. So July 1, 2005 equals to: 7/1/05 I am using this date...
2
by: musosdev | last post by:
Hi guys I'm having a problem with DateTime.Now.ToShortDateString(). It works fine, but I've got 2 servers (development and production), and while the production server works perfectly and...
3
by: ad | last post by:
I want to transfer a DateTime variable to string. I use DateTime.ToShortDateString() to do that. But if the date is 2006 May 23, I want to it transfer to 2006/05/23, not 2006/5/23. How can I do?
8
by: jpoquette | last post by:
I have recently upgraded a Visual Basic 2003 win forms application to 2005. After doing so I can no longer get my project to compile. The code is bombing on any line that uses an InputBox. I'm...
0
by: mvisnich | last post by:
Hi, I am working in VS2005 (VB) environment and I have following problem: On one of my web pages I use Datagrid control which I dynamically load. I also use numerical paging with Datagrid....
11
by: Chris Hough | last post by:
Hi I am using .NET v2.0 and recently sent an app to a client site that was working correctly in our office (SQLServer 2005 Express). When setting a date I use ToShortDateString() on a DateTime...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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
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
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,...
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
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
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...

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.