Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Format date in access query

Posted on 2014-09-15
2
628 Views
Last Modified: 2014-09-15
Experts,

Is there a way to format a date inputted as 20140101 to 2014-01-01 in an SQL statement in MS Access?
0
Comment
Question by:morinia
2 Comments
 
LVL 21

Accepted Solution

by:
Randy Poole earned 500 total points
ID: 40323285
I assume that is a string?  Select Left(yourfield,4)+'-'+Mid(yourfield,5,2)+'-'+Right(yourfield,2) as yourdate from yourtable
0
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40323301
Assuming "20140101" has been inputed as a date or datetime, then Format(<<field name>>,"yyyy-mm-dd") should work.

If it is a string, then Randy's answer is correct.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question