Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Help   Contact   Merch   Join   Order   Logon   Forums   
 
Back to Access Developers    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
SQL Date Format
Bartek Hutman 
    
10 months ago
I'm having issues with dates in queries recently. Turns out SQL converts dates to silly US format mm/dd/yyyy. Not sure when it happened, but it used to be whatever my system settings were. I'm in the UK and format we use is dd/mm/yyyy most of the time.
If I use format function on dates in my SQL code to convert to US format it returns correct values, but it's a pain to have to do it on all dates. Is there a way to change the default SQL date format to be in line with everything else? Access displays dates in correct UK format everywhere else, just not SQL...
Bartek Hutman OP  @Reply  
    
10 months ago

Bartek Hutman OP  @Reply  
    
10 months ago

Bartek Hutman OP  @Reply  
    
10 months ago

Kevin Robertson  @Reply  
          
10 months ago
That's actually a bad example because 17 is always going to be the day as there is not a 17th month.
Bartek Hutman OP  @Reply  
    
10 months ago

Bartek Hutman OP  @Reply  
    
10 months ago
that's the result of this particular query (just an example) with #17/06/2023# criteria. It should have returned 8 records with the same date. The SQL above is what access generated by the way
Alex Hedley  @Reply  
           
10 months ago
Kevin Yip  @Reply  
     
10 months ago
SQL always and only uses the US date format (mm/dd/yyyy).  It may be because the SQL standard was invented in the US.  If you use dd/mm/yyyy format in the SQL, Access can still correctly interpret it, but only if it's unambiguous.  If you write #31/1/2025#, Access can unambiguously interpret it as Jan-31-2025 since there is no month called "31".  But if you write #11/2/2025#, Access will always interpret it the American way, Nov-02-2025, because "11" is a valid month.

If you use two-digit year, there is one more scenario to watch out for.  If you write #31/1/25#, Access will not see it as Jan-31-2025, but Jan-25-2031 instead, because Access will think it is in ISO date format yy/mm/dd.  So, always use 4-digit year.
Kevin Yip  @Reply  
     
10 months ago
Even if you use an European version of Access, it will still force you to use the US date format.  The query designer accepts the European format, but the SQL statement itself (the only thing that counts) always has US dates.  This is not to give non-US people a hard time.  It's done because it's necessary.   The SQL is text-only, and it carries no information on which country the author of the SQL is from.  So there is no way to "switch" between two date formats.  So a fixed date format has to be used for everyone on Earth who use SQLs.
Kevin Yip  @Reply  
     
10 months ago
If you think this sucks, many people think so too.  That's why some database tools, such as Microsoft's own Power Apps, do not use SQL at all to query databases.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developers.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 8/7/2026 5:09:07 PM. PLT: 1s