?
Solved

Date formatting question

Posted on 2014-03-28
8
Medium Priority
?
321 Views
Last Modified: 2014-03-28
I have a date formatting question.   I need show the last day of the previous month on a report I am working on in Access 2013.  The format should be 20140228.
0
Comment
Question by:Mwvarner
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 40

Expert Comment

by:lcohan
ID: 39962264
use a function like FORMAT:


Format (#28/02/2014#, "yyyymmdd") would return '20140228'
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 1500 total points
ID: 39962269
use for dynamic result


=format(dateserial(Year(Date),month(date),0),"yyyymmdd")
0
 
LVL 52

Expert Comment

by:Gustav Brock
ID: 39962385
It would be:

=Format(DateSerial(Year(Date()),Month(Date()),0),"yyyymmdd")

/gustav
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Closing Comment

by:Mwvarner
ID: 39962400
That is what I needed but it needed a little tweaking.  She the corrected syntax below.

Format(DateSerial(Year(Date()),Month(Date())+0,0),"yyyymmdd")
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39962470
@Mwvarner.,

you just added a +0 that means NOTHING
0
 
LVL 2

Expert Comment

by:GowthamNatarajan
ID: 39962529
SELECT DATEADD("d", -DAY(date()), date() )
0
 

Author Comment

by:Mwvarner
ID: 39962536
I was referring to the () after the word date and that does mean something.
0
 
LVL 52

Expert Comment

by:Gustav Brock
ID: 39962913
Of course it means something. That's why I posted it as the solution.

/gustav
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
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 Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

807 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