473,396 Members | 1,995 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.

Problem with Dates

On Server1 when running my ASP:NET application and selecting records from an
SQL server the Dates show up in Swedish Format (yyyy-mm-dd) this is good
this is what I want.

Right now we are setting up a new server (Server2) with a SQL server as
well.. here the dates show up in this format (mm/dd/yyyy) and this I dont'
like.

I have set both servers to useer Swedish Reginoal and localtion settings in
Windows Server 2003 and I have checked the Coalision Name for the two SQL
servers and they are the same. But still it differs in the ASP:NET
applicaion. What other settings can I check.

What else can I check? I need this two two show the dates the same what
without using CultureInfo things on the thread or any own convert functoins.

is it the IIS or the SQL server who is responsible for these convertions?

best regards
/Lars Netzel
Nov 19 '05 #1
1 1159
If you return datetime as datetime and you have in your C# or VB .NET code
DateTime or SqlDateTime data type, then it is responsible of the ASP.NET
part of the code to format the datetime to string. You either use ToString()
with correct format provider (Culture) or you use it without format provider
(ToString() without parameters) then current thread's culture will be used.

If you want to hardcode the format, you can use ToString() with correct
format provider or if you're using databinding, then you should look for
Eval-method's parameters in aspx page.

My suggestion is to set current thread's culture to what ever you want at
runtime when the page is loaded. You know the user and therefore you know
the culture of the user (if you have that info). This is easy to do. Just
few lines of code to your base class of your pages.

JMu

"Lars Netzel" <la*********@NO-SPAM.qlogic.se> wrote in message
news:uX**************@TK2MSFTNGP10.phx.gbl...
On Server1 when running my ASP:NET application and selecting records from
an SQL server the Dates show up in Swedish Format (yyyy-mm-dd) this is
good this is what I want.

Right now we are setting up a new server (Server2) with a SQL server as
well.. here the dates show up in this format (mm/dd/yyyy) and this I dont'
like.

I have set both servers to useer Swedish Reginoal and localtion settings
in Windows Server 2003 and I have checked the Coalision Name for the two
SQL servers and they are the same. But still it differs in the ASP:NET
applicaion. What other settings can I check.

What else can I check? I need this two two show the dates the same what
without using CultureInfo things on the thread or any own convert
functoins.

is it the IIS or the SQL server who is responsible for these convertions?

best regards
/Lars Netzel

Nov 19 '05 #2

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

Similar topics

6
by: Jerome | last post by:
Hi, I know this is an old problem and I've already tried to look the solution up on the web but I didn't find what I need. So, there's the following situation: I've got an ASP page with a...
3
by: Lyn | last post by:
Hi, I am developing a project in which I am checking for records with overlapping start/end dates. Record dates must not overlap date of birth, date of death, be in the future, and must not...
3
by: StBond | last post by:
Hi everyone, I am new to Access and Visual Basic so things my be getting across a bit cloudy. I only started using VB for one week. I am having a little problem with the database that I am...
3
by: Andy_Khosravi | last post by:
I have been trying to build a user friendly search engine for a small database I have created. I'm having some particular problems with one of my date fields. Here's the setup: I'm using...
11
by: Geoff Jones | last post by:
Hi I have a table that has a column with Date types. I am trying to view certain rows in the table using a DataView. Using the filter, I can view the rows with, for example, the date equal...
3
by: seegoon | last post by:
Hi to all. I have a small problem I hope someone can help me with. I am running a sql query to a csv file. The query searches for the total of a column between 2 dates. This is a copy of one of...
2
by: hardik | last post by:
hi friends, i am really surprized the way access behaves in date fields i mean it's all ok when you have us time zone or us servers but if you have diffrent timezone like uk then access creates...
5
by: Dave | last post by:
Hello, I have a possible problem exporting a text field that happens to contain dates (but is not a date field) when using TransferText in MS Access 2000. I am exporting a query to a text...
7
by: creative1 | last post by:
Hello everyone. I am experiencing a strange problem that I can't fix on my own. I think I need expert's suggestions for this. The problem is: I want to print account statement (or any other...
2
by: Ceebaby via AccessMonster.com | last post by:
Hi Folks I wondered if someone could point me in the right direction before I completely tear my hair out. I have a user selection form where options can be selected for a report. Users now...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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
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.