473,394 Members | 1,750 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.

Access, ASP, DATE problems!

I have been coding with ASP for some time now. I am using an ACCESS
database. I am in the UK and wish to use DD/MM/YYYY format for dates.

I have had no end of problems and possible solutions to dates such as 1/8/05
being interpreted in the wrong way.

I have been given many suggestions (setting LCID, submitting dates in long
format etc. etc.)

Is there any definitive sloution or tutorial available? This is driving me
MAD!

I can get dates submitted OK but they get read back wrong. I alter the code
and then they are submited wrong but read OK from the database.

Someone please help!!!!!!!!!!!!!!!!
Neil
Nov 13 '05 #1
9 1885
Neil wrote in message <dc**********@newsg1.svr.pol.co.uk> :
I have been coding with ASP for some time now. I am using an ACCESS
database. I am in the UK and wish to use DD/MM/YYYY format for dates.

I have had no end of problems and possible solutions to dates such as 1/8/05
being interpreted in the wrong way.

I have been given many suggestions (setting LCID, submitting dates in long
format etc. etc.)

Is there any definitive sloution or tutorial available? This is driving me
MAD!

I can get dates submitted OK but they get read back wrong. I alter the code
and then they are submited wrong but read OK from the database.

Someone please help!!!!!!!!!!!!!!!!
Neil


Dates are stored as numbers, and displayed as dates. I'm assuming
you are communicating with the Jet engine through dynamic sql, which
is probably the only time this causes challenges, cause the Jet engine
needs the string representation of the date in an unambiguous format
to be able to determine whether 01/08/2005 is Aug 1 or Jan 8.

You will find some more info/suggestions here
http://allenbrowne.com/ser-36.html
http://www.mvps.org/access/datetime/date0005.htm

--
Roy-Vidar

Nov 13 '05 #2
Thanks for the reply

Yes I am using the JET engine.

One of your links says

"In all versions of Access (including the 16-bit versions), JET SQL clauses
require dates in American format. To demonstrate this, enter any date in the
Criteria row under a date field in Query Design, and then switch to SQL
View. In Query Design view, you see the date according to your local
settings, but the SQL statement uses mm/dd/yy format."

My code is successfully submitting dates (they appear in Access as
xx-MMMM-YY, i.e. if the date is submitted as 1/8/05 then access reports it
as 1-AUG-05, which is correct) but when I read them back through code they
are wrong (i.e. 8-Jan-05). What do I use in my VB code to read them correct?

I am really confused by all this!

"RoyVidar" <ro*************@yahoo.no> wrote in message
news:mn***********************@yahoo.no...
Neil wrote in message <dc**********@newsg1.svr.pol.co.uk> :
I have been coding with ASP for some time now. I am using an ACCESS
database. I am in the UK and wish to use DD/MM/YYYY format for dates.

I have had no end of problems and possible solutions to dates such as
1/8/05
being interpreted in the wrong way.

I have been given many suggestions (setting LCID, submitting dates in
long
format etc. etc.)

Is there any definitive sloution or tutorial available? This is driving
me
MAD!

I can get dates submitted OK but they get read back wrong. I alter the
code
and then they are submited wrong but read OK from the database.

Someone please help!!!!!!!!!!!!!!!!
Neil


Dates are stored as numbers, and displayed as dates. I'm assuming
you are communicating with the Jet engine through dynamic sql, which
is probably the only time this causes challenges, cause the Jet engine
needs the string representation of the date in an unambiguous format
to be able to determine whether 01/08/2005 is Aug 1 or Jan 8.

You will find some more info/suggestions here
http://allenbrowne.com/ser-36.html
http://www.mvps.org/access/datetime/date0005.htm

--
Roy-Vidar

Nov 13 '05 #3
Neil wrote in message <dc**********@newsg3.svr.pol.co.uk> :
Thanks for the reply

Yes I am using the JET engine.

One of your links says

"In all versions of Access (including the 16-bit versions), JET SQL clauses
require dates in American format. To demonstrate this, enter any date in the
Criteria row under a date field in Query Design, and then switch to SQL View.
In Query Design view, you see the date according to your local settings, but
the SQL statement uses mm/dd/yy format."

My code is successfully submitting dates (they appear in Access as
xx-MMMM-YY, i.e. if the date is submitted as 1/8/05 then access reports it as
1-AUG-05, which is correct) but when I read them back through code they are
wrong (i.e. 8-Jan-05). What do I use in my VB code to read them correct?

I am really confused by all this!

Sounds strange. In VBA I'd could perhaps do something like this on an
open
ADO connection, and assign to an ADO recordset

cn.execute "insert into mytable (mytext, mydate) values ('blah', #" & _
format$(date,"yyyy-mm-dd") & "#)",,adcmdtext+adexecutenorecords
set rs=cn.execute("select * from mytable where mytext =
'blah'",,adcmdtext)
debug.print rs.getstring

on my setups (with Access/VBA/Norwegian settings), I'd get the same
date I
put in, as long as the date is stored as a date/time, at least.

--
Roy-Vidar

Nov 13 '05 #4

"Neil" <ne**@logan-5.co.uk> wrote in message
news:dc**********@newsg1.svr.pol.co.uk...
I have been coding with ASP for some time now. I am using an ACCESS
database. I am in the UK and wish to use DD/MM/YYYY format for dates.

I have had no end of problems and possible solutions to dates such as
1/8/05
being interpreted in the wrong way.

I have been given many suggestions (setting LCID, submitting dates in long
format etc. etc.)

Is there any definitive sloution or tutorial available? This is driving me
MAD!

I can get dates submitted OK but they get read back wrong. I alter the
code
and then they are submited wrong but read OK from the database.

Someone please help!!!!!!!!!!!!!!!!
Neil

ASP has pretty limited functions to format dates. There are other solutions
to this, but I would write my own function so I could be sure the dates were
displayed correctly regardless of any machine/software configuration. For
example:

Function UkDate(dteDate)

Dim strTemp
Dim strReturn

strTemp = Day(dteDate)
If Len(strTemp) = 1 Then strTemp = "0" & strTemp
strReturn = strTemp & "/"

strTemp = Month(dteDate)
If Len(strTemp) = 1 Then strTemp = "0" & strTemp
strReturn = strReturn & strTemp & "/"

strTemp = Year(dteDate)
strReturn = strReturn & strTemp & "/"

UkDate = strReturn

End Function
Then you could use this function wherever you liked in your ASP code. You
might add some error handling for when the variable passed is not a date or
is null.
Nov 13 '05 #5
Thanks for all your help guys. Much appreciated. I will give all those
suggestions a go.

Neil

"Justin Hoffman" <j@b.com> wrote in message
news:dc**********@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...

"Neil" <ne**@logan-5.co.uk> wrote in message
news:dc**********@newsg1.svr.pol.co.uk...
I have been coding with ASP for some time now. I am using an ACCESS
database. I am in the UK and wish to use DD/MM/YYYY format for dates.

I have had no end of problems and possible solutions to dates such as
1/8/05
being interpreted in the wrong way.

I have been given many suggestions (setting LCID, submitting dates in
long
format etc. etc.)

Is there any definitive sloution or tutorial available? This is driving
me
MAD!

I can get dates submitted OK but they get read back wrong. I alter the
code
and then they are submited wrong but read OK from the database.

Someone please help!!!!!!!!!!!!!!!!
Neil

ASP has pretty limited functions to format dates. There are other
solutions to this, but I would write my own function so I could be sure
the dates were displayed correctly regardless of any machine/software
configuration. For example:

Function UkDate(dteDate)

Dim strTemp
Dim strReturn

strTemp = Day(dteDate)
If Len(strTemp) = 1 Then strTemp = "0" & strTemp
strReturn = strTemp & "/"

strTemp = Month(dteDate)
If Len(strTemp) = 1 Then strTemp = "0" & strTemp
strReturn = strReturn & strTemp & "/"

strTemp = Year(dteDate)
strReturn = strReturn & strTemp & "/"

UkDate = strReturn

End Function
Then you could use this function wherever you liked in your ASP code. You
might add some error handling for when the variable passed is not a date
or is null.

Nov 13 '05 #6
Neil

Code:

SetLocale("en-gb")

At the beginning of your ASP pages and (hopefully!) all your problems will go
away..

Regards

Nigel

(In the Uk)

On Mon, 25 Jul 2005 22:56:56 +0100, "Neil" <ne**@logan-5.co.uk> wrote:
I have been coding with ASP for some time now. I am using an ACCESS
database. I am in the UK and wish to use DD/MM/YYYY format for dates.

I have had no end of problems and possible solutions to dates such as 1/8/05
being interpreted in the wrong way.

I have been given many suggestions (setting LCID, submitting dates in long
format etc. etc.)

Is there any definitive sloution or tutorial available? This is driving me
MAD!

I can get dates submitted OK but they get read back wrong. I alter the code
and then they are submited wrong but read OK from the database.

Someone please help!!!!!!!!!!!!!!!!
Neil


Nov 13 '05 #7
Hi Nigel

I had already used

Session.LCID = 2057

at the beginning of my ASP pages.

Is that something different to what you suggested?

Thanks
Neil

"N Benson" <ni***@lbenny1.demon.co.uk> wrote in message
news:99********************************@4ax.com...
Neil

Code:

SetLocale("en-gb")

At the beginning of your ASP pages and (hopefully!) all your problems will
go
away..

Regards

Nigel

(In the Uk)

On Mon, 25 Jul 2005 22:56:56 +0100, "Neil" <ne**@logan-5.co.uk> wrote:
I have been coding with ASP for some time now. I am using an ACCESS
database. I am in the UK and wish to use DD/MM/YYYY format for dates.

I have had no end of problems and possible solutions to dates such as
1/8/05
being interpreted in the wrong way.

I have been given many suggestions (setting LCID, submitting dates in long
format etc. etc.)

Is there any definitive sloution or tutorial available? This is driving me
MAD!

I can get dates submitted OK but they get read back wrong. I alter the
code
and then they are submited wrong but read OK from the database.

Someone please help!!!!!!!!!!!!!!!!
Neil

Nov 13 '05 #8
Neil

I've never had a problem with Setlocale, however I think it only affects the
scripting engine that ASP uses. Session.LCID affects both the ASP application
and the scripting engine..

Another possible cause is the LCID number used, there are two for English - UK
2057 and 1033 - you need to have the language pack available on the machine. (Or
it'll probably revert to the default (Whatever that is!) Try using 1033 instead,
they may be different.

Regards

Nigel

On Tue, 26 Jul 2005 18:12:14 +0100, "Neil" <ne**@logan-5.co.uk> wrote:
Hi Nigel

I had already used

Session.LCID = 2057

at the beginning of my ASP pages.

Is that something different to what you suggested?

Thanks
Neil

"N Benson" <ni***@lbenny1.demon.co.uk> wrote in message
news:99********************************@4ax.com.. .
Neil

Code:

SetLocale("en-gb")

At the beginning of your ASP pages and (hopefully!) all your problems will
go
away..

Regards

Nigel

(In the Uk)

On Mon, 25 Jul 2005 22:56:56 +0100, "Neil" <ne**@logan-5.co.uk> wrote:
I have been coding with ASP for some time now. I am using an ACCESS
database. I am in the UK and wish to use DD/MM/YYYY format for dates.

I have had no end of problems and possible solutions to dates such as
1/8/05
being interpreted in the wrong way.

I have been given many suggestions (setting LCID, submitting dates in long
format etc. etc.)

Is there any definitive sloution or tutorial available? This is driving me
MAD!

I can get dates submitted OK but they get read back wrong. I alter the
code
and then they are submited wrong but read OK from the database.

Someone please help!!!!!!!!!!!!!!!!
Neil


Nov 13 '05 #9
Thanks Nigel

I will investigate .....

"N Benson" <ni***@lbenny1.demon.co.uk> wrote in message
news:3k********************************@4ax.com...
Neil

I've never had a problem with Setlocale, however I think it only affects
the
scripting engine that ASP uses. Session.LCID affects both the ASP
application
and the scripting engine..

Another possible cause is the LCID number used, there are two for
English - UK
2057 and 1033 - you need to have the language pack available on the
machine. (Or
it'll probably revert to the default (Whatever that is!) Try using 1033
instead,
they may be different.

Regards

Nigel

On Tue, 26 Jul 2005 18:12:14 +0100, "Neil" <ne**@logan-5.co.uk> wrote:
Hi Nigel

I had already used

Session.LCID = 2057

at the beginning of my ASP pages.

Is that something different to what you suggested?

Thanks
Neil

"N Benson" <ni***@lbenny1.demon.co.uk> wrote in message
news:99********************************@4ax.com. ..
Neil

Code:

SetLocale("en-gb")

At the beginning of your ASP pages and (hopefully!) all your problems
will
go
away..

Regards

Nigel

(In the Uk)

On Mon, 25 Jul 2005 22:56:56 +0100, "Neil" <ne**@logan-5.co.uk> wrote:

I have been coding with ASP for some time now. I am using an ACCESS
database. I am in the UK and wish to use DD/MM/YYYY format for dates.

I have had no end of problems and possible solutions to dates such as
1/8/05
being interpreted in the wrong way.

I have been given many suggestions (setting LCID, submitting dates in
long
format etc. etc.)

Is there any definitive sloution or tutorial available? This is driving
me
MAD!

I can get dates submitted OK but they get read back wrong. I alter the
code
and then they are submited wrong but read OK from the database.

Someone please help!!!!!!!!!!!!!!!!
Neil

Nov 13 '05 #10

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

Similar topics

1
by: mark | last post by:
In Access 2000 and 2002, I have created an import specification to import the fixed-width recordset below into an existing table. I am having strange problems with the import of the date and time...
0
by: Frederick Noronha \(FN\) | last post by:
---------- Forwarded message ---------- Solutions to Everyday User Interface and Programming Problems O'Reilly Releases "Access Cookbook, Second Edition" Sebastopol, CA--Neither reference book...
8
by: William Bradley | last post by:
First of all I have been working with Access 97 and this morning the owner of the business phoned me to inform me that he had updated to Access 2000 and parts of my forms would not work anymore. ...
17
by: Mell via AccessMonster.com | last post by:
Is there a way to find out where an application was created from? i.e. - work or home i.e. - if application sits on a (work) server/network, the IT people know the application is sitting...
5
by: Henning M | last post by:
Hi all, I having some problems with Access and selecting records between dates.. When I try this in access, it works fine!! "Select * from Bilag Where Mdates Between #1/1/2006# And...
10
by: rcnews | last post by:
Hi, First timer here. Where's the best place to educate myself on how to use PHP in conjunction with Microsoft Access--good online tutorials, sites, blogs, etc...? I work at a small online...
3
by: Jim in Arizona | last post by:
I have a gridview that's being populated from an access db query. The problem I'm having is that the date/time fields in access that are populating the gridview are showing both date and time, when...
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...
9
by: Ron | last post by:
Hi All, I've recently installed a program written in Access 2000 on a laptop. The laptop had an existing Office 2000 Pro which of course included Access. But the program acts oddly (more oddly...
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: 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
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
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
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
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.