473,324 Members | 2,214 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,324 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 1155
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.