Solved

Access: Display Year and Quarter from Date field

Posted on 2009-05-08
4
613 Views
Last Modified: 2012-08-14
I want to know how I can display the year and quarter from a field that contains the date, example datefield. The format of the field is as follow: 4/30/2009  3:51:00 PM. I would like to create a table and have a field name "Year and Quarter" and display the data as 2009-Q2.
0
Comment
Question by:Unreal1998
  • 2
4 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 500 total points
ID: 24337909
Try this:

SELECT DatePart("yyyy",[datefield]) & "-Q" & DatePart("q",[datefield]) AS YQ INTO TableYQ
FROM Table1;


mx
0
 
LVL 1

Expert Comment

by:mcfitz13
ID: 24342126
You can use the format tool

'Quarter
Format(Now,"q")

'Year
Format(Now,"yyyy")

Together
Format(Now,"yyyy") & "Q" &  Format(Now,"q")
0
 
LVL 44

Expert Comment

by:GRayL
ID: 24344148
How about Format(fldDate,"yyyy-\Qq")
0
 
LVL 44

Expert Comment

by:GRayL
ID: 24344162
More precisely:

SELECT fldDate, Format(fldDate,"yyyy-\Qq") AS [Year and Quarter] FROM myTable;
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA Access 2016 syntax 6 43
DSN-LESS connection to MS Access database 6 29
Obtaining Access 2013 Runtime file for Sagekey 2013 Installer 3 19
Modify report 8 5
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

773 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