473,473 Members | 2,262 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Date format confusion

Hi all
Im in Ireland, so date format is always dd/mm/yy.

It trying use query as a filter for a recordset, containing a date field,

SELECT tblInspections.InspDate FROM tblInspections WHERE
(tblInspections.InspDate Between #01/06/03# and #30/06/03#);

but when I look at the result of this in teh QBE window, I get dates
Between #06/01/03# And #03/06/30#,
and the results of the filter bear this out.

Ive been working with access for some years now, and this problem still gets
me confused.
Could someone please exlpain the best approach to handing dates, given that
they must always be displayed to the user in the dd/mm/yy format.

Thanks in advance.
Gerry

Nov 13 '05 #1
3 2364
Hi Gerry

Your on the right track, except Access is a US product and you have to
follow their format. The format should be month, then day then year. For
example 1 June 2003 is #06/01/2003#.

Jeff Pritchard
________________
Asken Research Pty. Ltd.
Access Database Developers
www.asken.com.au

"Gerry Abbott" <pl****@ask.ie> wrote in message
news:cQ*****************@news.indigo.ie...
Hi all
Im in Ireland, so date format is always dd/mm/yy.

It trying use query as a filter for a recordset, containing a date field,

SELECT tblInspections.InspDate FROM tblInspections WHERE
(tblInspections.InspDate Between #01/06/03# and #30/06/03#);

but when I look at the result of this in teh QBE window, I get dates
Between #06/01/03# And #03/06/30#,
and the results of the filter bear this out.

Ive been working with access for some years now, and this problem still gets me confused.
Could someone please exlpain the best approach to handing dates, given that they must always be displayed to the user in the dd/mm/yy format.

Thanks in advance.
Gerry


Nov 13 '05 #2
Found the problem,

I had defined the dates a type date, they should have been string to put
into the sql string.
So I just had to get the dates, as dates, then format them as I required,
then convert to strings, and add to sql.
"Gerry Abbott" <pl****@ask.ie> wrote in message
news:cQ*****************@news.indigo.ie...
Hi all
Im in Ireland, so date format is always dd/mm/yy.

It trying use query as a filter for a recordset, containing a date field,

SELECT tblInspections.InspDate FROM tblInspections WHERE
(tblInspections.InspDate Between #01/06/03# and #30/06/03#);

but when I look at the result of this in teh QBE window, I get dates
Between #06/01/03# And #03/06/30#,
and the results of the filter bear this out.

Ive been working with access for some years now, and this problem still gets me confused.
Could someone please exlpain the best approach to handing dates, given that they must always be displayed to the user in the dd/mm/yy format.

Thanks in advance.
Gerry


Nov 13 '05 #3
Hi Folks

In MS access they are internally convert the supplied date parameter
into number format and then they compare.

please try the following it may solve the purpose

SELECT tblInspections.InspDate FROM tblInspections WHERE
ConvDateYYYYMMDD(tblInspections.InspDate ) >
ConvDateYYYYMMDD('02/01/2004')
and ConvDateYYYYMMDD(tblInspections.InspDate ) <
ConvDateYYYYMMDD('05/01/2004')
ConvDateYYYYMMDD is VBA Function which will Convert Date into
YYYYMMDD format
'Author Sathya
'Verison 1.1.2
Function ConvDateYYYYMMDD(Dte As Date)
' Date Format DD/MM/YYYY for dte

Dim strTemp As String
Dim strDay As String
Dim strDayTemp As String
Dim strMonth As String
Dim strYear As String
Dim strMonthTemp As String

strDayTemp = Datepart("d", Dte)
If Len(strDayTemp) < 2 Then
strDay = "0" + strDayTemp
Else
strDay = strDayTemp
End If

strMonthTemp = Datepart("m", Dte)
If Len(strMonthTemp) < 2 Then
strMonth = "0" & strMonthTemp
Else
strMonth = strMonthTemp
End If

strYear = Datepart("yyyy", Dte)
ConvDateYYYYMMDD = strYear + strMonth + strDay

End Function

"Gerry Abbott" <pl****@ask.ie> wrote in message news:<cQ*****************@news.indigo.ie>...
Hi all
Im in Ireland, so date format is always dd/mm/yy.

It trying use query as a filter for a recordset, containing a date field,

SELECT tblInspections.InspDate FROM tblInspections WHERE
(tblInspections.InspDate Between #01/06/03# and #30/06/03#);

but when I look at the result of this in teh QBE window, I get dates
Between #06/01/03# And #03/06/30#,
and the results of the filter bear this out.

Ive been working with access for some years now, and this problem still gets
me confused.
Could someone please exlpain the best approach to handing dates, given that
they must always be displayed to the user in the dd/mm/yy format.

Thanks in advance.
Gerry

Nov 13 '05 #4

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

Similar topics

5
by: Willem-Jan Selen | last post by:
Hi everybody, When I use the following to add a record to a database rs.addNew rs("ReplyTo") = ReplyToID rs("mID") = Request.cookies("IsLogged")("mid") rs("Topic") = Topic rs("Message") =...
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: Tapi | last post by:
I have two folders on my webserver or under wwwroot/inetpub. A response.write date() date in the format dd/mm/yyyy in one folder and mm/dd/yyyy in the other folder. Why is this? I use one of the...
2
by: amith | last post by:
hi I have written javascript for comparing two dates in US format and finding out whether the start date is greater than the end date and vice versa. In this attempt i have instantiated the...
3
by: Dino | last post by:
I am creating a website that is going to ask the user to enter a date! then from an access database get all records where a date field is greater then the date entered! Sounds simple, I do it in...
2
by: andybriggs | last post by:
An Access 97 database is running quite happily on about 30 IBM ThinkPads. Some of the users, however, have now installed some components of Office 2000 like Word and Excel. On those machines, the...
2
by: amatuer | last post by:
In Sa the date format is dd/mm/yy. in sql server the format the format is mm/dd/yy. What code can be used to chnge the format to the SA date format eithout chnging sql servers regional settings?
10
by: ARC | last post by:
Hello all, General question for back-end database that has numerous date fields where the database will be used in regions that put the month first, and regions that do not. Should I save a...
1
by: EyeHawk | last post by:
OK, hopefully somebody can help me out again. My next problem is updating 3 form fields (type list/menu option) that correspond to a date, one for month, one for day and one for year when the user...
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...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.