[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Substract 1 day from date()

Posted on 2008-11-13
4
Medium Priority
?
203 Views
Last Modified: 2012-05-05
Experts,
I would like to subtract 1 day from date()
0
Comment
Question by:Frank Freese
  • 2
4 Comments
 
LVL 58

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 1000 total points
ID: 22950754

  What you want to use is the DateAdd() function:

  =DateAdd("d",Now(),-1)

JimD.
0
 
LVL 18

Assisted Solution

by:jmoss111
jmoss111 earned 1000 total points
ID: 22950755
MyDate = Date() -1
0
 
LVL 58
ID: 22950783
oops, got the arguments wrong:

 =DateAdd("d",-1,Now())

  Date/Time fields are also simply a double float with the whole number portion represneting the date, so you could also do:

  =Now() - 1

  But I would use DateAdd() for a number of reasons; it's clearer what's going on, works with every type of period (days, weeks, years, etc) and takes care of the time as well.

JimD.
0
 

Author Closing Comment

by:Frank Freese
ID: 31516394
thanks...killed 2 birds with one stone.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
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…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

831 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