Solved

Access: Display Year and Quarter from Date field

Posted on 2009-05-08
4
616 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 - Microsoft MVP, Access and Data Platform) 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
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…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

840 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