Date & Time Query

E_Gold

Registered User.
Local time
Today, 15:55
Joined
Sep 18, 2010
Messages
26
hi

if my computer region set to dd/MM/yyyy hh:mm and my query in access:
Code:
select * from MyTbl where MyDate between #25/12/2010 10:51# and #30/12/2010 12:11#

is this query will work on computer that his region set to MM/dd/yyyy hh:mm ?

if no, how to fix it without change the region in the computer ?

thank's in advance
 
If you're just using SQL you don't need to worry about the region. It should interpret the date as the local region. However, if you are using VBA then you will need to present the date in US format. You can use the FORMAT function to do this:

Format("25/12/2010 10:51","mm/dd/yyy hh:nn")

hth
Chris
 
I would encourage developers to move to ISO date format (YYYY/MM/DD) in code because it is completely unambiguous regardless of the system date format.

I also prefer to Format with the date delimiters included rather than concatenating them.

Format(somedate, "\#yyyy/mm/dd hh:nn\#")
 

Users who are viewing this thread

Back
Top Bottom