By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,497 Members | 1,287 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,497 IT Pros & Developers. It's quick & easy.

ASP date problems.

P: n/a
TC
Hi.

I have some ASP written in VB.net which is currently installed on a
customers server. The asp connects to a local MySql database and retrieves
data for the customers customers. If you see what I mean.

The problem is their server insists on showing dates in the US format. The
server has no other language installed than UK and all settings I can find
are UK.

My test server here, which as far as I can see is setup the same, shows
dates in the correct UK format.

Has anyone come accross this, or have any ideas?

Cheers.
Apr 8 '08 #1
Share this Question
Share on Google+
9 Replies


P: n/a
Could be a number of reasons for this, the first that comes to mind is that
the web server account has the wrong regional info.

I few questions:

What code are you using to format the dates?
Are you using the <globalizationelement in your web.config (and if so, how
is it set)?
Is the US format consistant across different browsers/machines?

/claes
"TC" <tu**@idcodeware.co.ukwrote in message
news:uI**************@TK2MSFTNGP03.phx.gbl...
Hi.

I have some ASP written in VB.net which is currently installed on a
customers server. The asp connects to a local MySql database and
retrieves data for the customers customers. If you see what I mean.

The problem is their server insists on showing dates in the US format.
The server has no other language installed than UK and all settings I can
find are UK.

My test server here, which as far as I can see is setup the same, shows
dates in the correct UK format.

Has anyone come accross this, or have any ideas?

Cheers.

Apr 8 '08 #2

P: n/a
TC
I'm not really using anything to format the dates, the return from MySql is,
as far as I know, the international format, so it's hh:mm:ss yyyy/mm/dd.
For putting data in the grid I'm simply looking for the " " (Space char) and
returning the right of the string.

Yes, it is repeated over any browser or client connection so the issue has
to be server side.

The Web Server account? The user account that controls access to the web
site?

I'm a little new to this technology so any help would be very much
appreciated.

Cheers.

"Claes Bergefall" <cl*************@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Could be a number of reasons for this, the first that comes to mind is
that the web server account has the wrong regional info.

I few questions:

What code are you using to format the dates?
Are you using the <globalizationelement in your web.config (and if so,
how is it set)?
Is the US format consistant across different browsers/machines?

/claes
"TC" <tu**@idcodeware.co.ukwrote in message
news:uI**************@TK2MSFTNGP03.phx.gbl...
>Hi.

I have some ASP written in VB.net which is currently installed on a
customers server. The asp connects to a local MySql database and
retrieves data for the customers customers. If you see what I mean.

The problem is their server insists on showing dates in the US format.
The server has no other language installed than UK and all settings I can
find are UK.

My test server here, which as far as I can see is setup the same, shows
dates in the correct UK format.

Has anyone come accross this, or have any ideas?

Cheers.


Apr 8 '08 #3

P: n/a
Usually the date format is controlled throught the globalization tag in the
web.config file.

Not sure about MySql but generally a DB system returns a date value not
text. So this is still a date value client side. This is only when the text
is written to text that this is converted to the text representation for the
current country whatever it is...

So try :
http://msdn2.microsoft.com/en-us/lib...e0(VS.80).aspx (culture,
uiCulture)
"TC" <tu**@idcodeware.co.uka écrit dans le message de news:
%2****************@TK2MSFTNGP05.phx.gbl...
I'm not really using anything to format the dates, the return from MySql
is, as far as I know, the international format, so it's hh:mm:ss
yyyy/mm/dd. For putting data in the grid I'm simply looking for the " "
(Space char) and returning the right of the string.

Yes, it is repeated over any browser or client connection so the issue has
to be server side.

The Web Server account? The user account that controls access to the web
site?

I'm a little new to this technology so any help would be very much
appreciated.

Cheers.

"Claes Bergefall" <cl*************@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>Could be a number of reasons for this, the first that comes to mind is
that the web server account has the wrong regional info.

I few questions:

What code are you using to format the dates?
Are you using the <globalizationelement in your web.config (and if so,
how is it set)?
Is the US format consistant across different browsers/machines?

/claes
"TC" <tu**@idcodeware.co.ukwrote in message
news:uI**************@TK2MSFTNGP03.phx.gbl...
>>Hi.

I have some ASP written in VB.net which is currently installed on a
customers server. The asp connects to a local MySql database and
retrieves data for the customers customers. If you see what I mean.

The problem is their server insists on showing dates in the US format.
The server has no other language installed than UK and all settings I
can find are UK.

My test server here, which as far as I can see is setup the same, shows
dates in the correct UK format.

Has anyone come accross this, or have any ideas?

Cheers.



Apr 8 '08 #4

P: n/a
TC
I've had a look at the Web.Config file, but can't see anything in there for
date formats or globalization, maybe this is the problem. What should I be
looking for?

Cheers.

"Patrice" <http://www.chez.com/scribe/wrote in message
news:uW**************@TK2MSFTNGP05.phx.gbl...
Usually the date format is controlled throught the globalization tag in
the web.config file.

Not sure about MySql but generally a DB system returns a date value not
text. So this is still a date value client side. This is only when the
text is written to text that this is converted to the text representation
for the current country whatever it is...

So try :
http://msdn2.microsoft.com/en-us/lib...e0(VS.80).aspx (culture,
uiCulture)
"TC" <tu**@idcodeware.co.uka écrit dans le message de news:
%2****************@TK2MSFTNGP05.phx.gbl...
>I'm not really using anything to format the dates, the return from MySql
is, as far as I know, the international format, so it's hh:mm:ss
yyyy/mm/dd. For putting data in the grid I'm simply looking for the " "
(Space char) and returning the right of the string.

Yes, it is repeated over any browser or client connection so the issue
has to be server side.

The Web Server account? The user account that controls access to the web
site?

I'm a little new to this technology so any help would be very much
appreciated.

Cheers.

"Claes Bergefall" <cl*************@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>>Could be a number of reasons for this, the first that comes to mind is
that the web server account has the wrong regional info.

I few questions:

What code are you using to format the dates?
Are you using the <globalizationelement in your web.config (and if so,
how is it set)?
Is the US format consistant across different browsers/machines?

/claes
"TC" <tu**@idcodeware.co.ukwrote in message
news:uI**************@TK2MSFTNGP03.phx.gbl...
Hi.

I have some ASP written in VB.net which is currently installed on a
customers server. The asp connects to a local MySql database and
retrieves data for the customers customers. If you see what I mean.

The problem is their server insists on showing dates in the US format.
The server has no other language installed than UK and all settings I
can find are UK.

My test server here, which as far as I can see is setup the same, shows
dates in the correct UK format.

Has anyone come accross this, or have any ideas?

Cheers.



Apr 8 '08 #5

P: n/a
TC
I've just changed the code so I'm forcing the culture to en-NZ, there
doesn't appear to be an en-UK setting. However NZ gives the same date
format required. However, again it works on my server, not on the
customers. I'm confused!

"TC" <tu**@idcodeware.co.ukwrote in message
news:uB*************@TK2MSFTNGP04.phx.gbl...
I've had a look at the Web.Config file, but can't see anything in there
for date formats or globalization, maybe this is the problem. What should
I be looking for?

Cheers.

"Patrice" <http://www.chez.com/scribe/wrote in message
news:uW**************@TK2MSFTNGP05.phx.gbl...
>Usually the date format is controlled throught the globalization tag in
the web.config file.

Not sure about MySql but generally a DB system returns a date value not
text. So this is still a date value client side. This is only when the
text is written to text that this is converted to the text representation
for the current country whatever it is...

So try :
http://msdn2.microsoft.com/en-us/lib...e0(VS.80).aspx (culture,
uiCulture)
"TC" <tu**@idcodeware.co.uka écrit dans le message de news:
%2****************@TK2MSFTNGP05.phx.gbl...
>>I'm not really using anything to format the dates, the return from MySql
is, as far as I know, the international format, so it's hh:mm:ss
yyyy/mm/dd. For putting data in the grid I'm simply looking for the " "
(Space char) and returning the right of the string.

Yes, it is repeated over any browser or client connection so the issue
has to be server side.

The Web Server account? The user account that controls access to the
web site?

I'm a little new to this technology so any help would be very much
appreciated.

Cheers.

"Claes Bergefall" <cl*************@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl.. .
Could be a number of reasons for this, the first that comes to mind is
that the web server account has the wrong regional info.

I few questions:

What code are you using to format the dates?
Are you using the <globalizationelement in your web.config (and if
so, how is it set)?
Is the US format consistant across different browsers/machines?

/claes
"TC" <tu**@idcodeware.co.ukwrote in message
news:uI**************@TK2MSFTNGP03.phx.gbl...
Hi.
>
I have some ASP written in VB.net which is currently installed on a
customers server. The asp connects to a local MySql database and
retrieves data for the customers customers. If you see what I mean.
>
The problem is their server insists on showing dates in the US format.
The server has no other language installed than UK and all settings I
can find are UK.
>
My test server here, which as far as I can see is setup the same,
shows dates in the correct UK format.
>
Has anyone come accross this, or have any ideas?
>
Cheers.
>




Apr 8 '08 #6

P: n/a
I'm not familiar with MySQL but I would expect the data to be stored using
some kind of datetime data type and not as text. In SQL Server you would use
smalldatetime or datetime to store a date and then work with the .NET
DateTime datatype in your ASP.NET pages. Once you have a DateTime object you
would use it's ToString method to format it in whatever way you want (see
DateTime.ToString)

If it's really stored as text and you simply extract the right part of the
string then I don't see any way for it to change format to US. If that is
the case the problem is in the MySQL server. You need to verify what
datatype is used and what it looks like. It would help if you could show the
code you're using to get the date from the database.

The <globalizationtag in web.config allows the web server to provide
formating according to the user's preferences. It gets this information from
the client browser (e.g. in IE you can specify what language you prefer in
the options). However, this only works if you're using real date types, so
figure out the things above first and you can deal with this step later
(it's entirely optional anyway)

As for the account thing; the process that hosts your ASP.NET application on
the web server (I'm guessing IIS?) runs under it's own account called ASPNET
(or something like that). That account has it's own settings regarding
security, culture info etc. If the machine was installed using a UK version
on Windows it most likely has the correct settings already.

/claes

"TC" <tu**@idcodeware.co.ukwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
I'm not really using anything to format the dates, the return from MySql
is, as far as I know, the international format, so it's hh:mm:ss
yyyy/mm/dd. For putting data in the grid I'm simply looking for the " "
(Space char) and returning the right of the string.

Yes, it is repeated over any browser or client connection so the issue has
to be server side.

The Web Server account? The user account that controls access to the web
site?

I'm a little new to this technology so any help would be very much
appreciated.

Cheers.

"Claes Bergefall" <cl*************@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>Could be a number of reasons for this, the first that comes to mind is
that the web server account has the wrong regional info.

I few questions:

What code are you using to format the dates?
Are you using the <globalizationelement in your web.config (and if so,
how is it set)?
Is the US format consistant across different browsers/machines?

/claes
"TC" <tu**@idcodeware.co.ukwrote in message
news:uI**************@TK2MSFTNGP03.phx.gbl...
>>Hi.

I have some ASP written in VB.net which is currently installed on a
customers server. The asp connects to a local MySql database and
retrieves data for the customers customers. If you see what I mean.

The problem is their server insists on showing dates in the US format.
The server has no other language installed than UK and all settings I
can find are UK.

My test server here, which as far as I can see is setup the same, shows
dates in the correct UK format.

Has anyone come accross this, or have any ideas?

Cheers.



Apr 9 '08 #7

P: n/a
TC
No, the date is stored as a date, MySql basically uses 00:00:00 yyyy/MM/dd
as standard. So I've been pulling the date time from the database and
formatting text simply to remove anything left of the space char. So the
date format is already wrong before I do any formating.

I have tried forcing the culture, forcing a Format("dd/MM/yyyy", dte) but it
still shows US format of M/d/yyyy.

I'm beggining to think there is a problem with this server!

"Claes Bergefall" <cl*************@nospam.nospamwrote in message
news:u1**************@TK2MSFTNGP05.phx.gbl...
I'm not familiar with MySQL but I would expect the data to be stored using
some kind of datetime data type and not as text. In SQL Server you would
use smalldatetime or datetime to store a date and then work with the .NET
DateTime datatype in your ASP.NET pages. Once you have a DateTime object
you would use it's ToString method to format it in whatever way you want
(see DateTime.ToString)

If it's really stored as text and you simply extract the right part of the
string then I don't see any way for it to change format to US. If that is
the case the problem is in the MySQL server. You need to verify what
datatype is used and what it looks like. It would help if you could show
the code you're using to get the date from the database.

The <globalizationtag in web.config allows the web server to provide
formating according to the user's preferences. It gets this information
from the client browser (e.g. in IE you can specify what language you
prefer in the options). However, this only works if you're using real date
types, so figure out the things above first and you can deal with this
step later (it's entirely optional anyway)

As for the account thing; the process that hosts your ASP.NET application
on the web server (I'm guessing IIS?) runs under it's own account called
ASPNET (or something like that). That account has it's own settings
regarding security, culture info etc. If the machine was installed using a
UK version on Windows it most likely has the correct settings already.

/claes

"TC" <tu**@idcodeware.co.ukwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>I'm not really using anything to format the dates, the return from MySql
is, as far as I know, the international format, so it's hh:mm:ss
yyyy/mm/dd. For putting data in the grid I'm simply looking for the " "
(Space char) and returning the right of the string.

Yes, it is repeated over any browser or client connection so the issue
has to be server side.

The Web Server account? The user account that controls access to the web
site?

I'm a little new to this technology so any help would be very much
appreciated.

Cheers.

"Claes Bergefall" <cl*************@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>>Could be a number of reasons for this, the first that comes to mind is
that the web server account has the wrong regional info.

I few questions:

What code are you using to format the dates?
Are you using the <globalizationelement in your web.config (and if so,
how is it set)?
Is the US format consistant across different browsers/machines?

/claes
"TC" <tu**@idcodeware.co.ukwrote in message
news:uI**************@TK2MSFTNGP03.phx.gbl...
Hi.

I have some ASP written in VB.net which is currently installed on a
customers server. The asp connects to a local MySql database and
retrieves data for the customers customers. If you see what I mean.

The problem is their server insists on showing dates in the US format.
The server has no other language installed than UK and all settings I
can find are UK.

My test server here, which as far as I can see is setup the same, shows
dates in the correct UK format.

Has anyone come accross this, or have any ideas?

Cheers.



Apr 9 '08 #8

P: n/a
TC wrote:
I've just changed the code so I'm forcing the culture to en-NZ, there
doesn't appear to be an en-UK setting.
It would be en-gb, not en-uk.

For an Access db, you can specify the locale in the connection string, e.g.:

"Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;Locale
Identifier=2057;Uid=Admin;Pwd=;"

....maybe you can find similar for mySql.

Andrew
Apr 9 '08 #9

P: n/a

"TC" <tu**@idcodeware.co.ukwrote in message
news:OP**************@TK2MSFTNGP03.phx.gbl...
No, the date is stored as a date, MySql basically uses 00:00:00 yyyy/MM/dd
as standard. So I've been pulling the date time from the database and
formatting text simply to remove anything left of the space char. So the
date format is already wrong before I do any formating.
This doesn't make sense. If the date is stored in the database using a real
date type then where are you getting the string 00:00:00 yyyy/MM/dd from?
Who created that string? What kind of data type do you have on the .NET side
of things?

I looked into MySQL a bit more and I noticed they have an ADO.NET library
with a MySqlDateTime type. Is this what you're using? If so you should be
able to get a real .NET DateTime object using the MySqlDateTime.GetDateTime
method. Once you have that it's a simple thing to format it the way you
want.

It would help if you could show us the code you're using to get the dates
from the database and also how you're formatting the output.

>I have tried forcing the culture, forcing a Format("dd/MM/yyyy", dte) but
it still shows US format of M/d/yyyy.
Is this .NET code? What's the datatype of the dte parameter?

>I'm beggining to think there is a problem with this server!
Well, it looks like the server is not setup exactly the same way as your
test server. On the other hand I also think there is a problem with your
code in the way it handles dates.
/claes
Apr 10 '08 #10

This discussion thread is closed

Replies have been disabled for this discussion.