[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 204
  • Last Modified:

Adding 2 hours to a value

I have a date/time field called OrderEndTime. How do I add (x) amount of hours/minutes to the value?
0
Greekiwi
Asked:
Greekiwi
  • 2
  • 2
  • 2
  • +2
3 Solutions
 
peakpeakCommented:
Script code examples to build from here:
http://www.outlookcode.com (download Sues Code examples)
http://www.slovaktech.com/code_samples.htm
0
 
MNelson831Commented:
Search Access help for "DATEADD"

dtNewValue = Dateadd(h,intIncrement, dtOriginaldate)
0
 
peakpeakCommented:
Script code examples to build from here:
http://www.outlookcode.com (download Sues code examples)
http://www.slovaktech.com/code_samples.htm
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Jim P.Commented:
To add hours it is

DateAdd("h",2,MyDateTime)

If it is hours and minutes then it would be

DateAdd("n",2.5*60,now())
0
 
TextReportCommented:
As well as the dateadd function you can use the datetime format of hours:minutes:seconds as in #hh:nn:ss#
=Date()+#2:30:00#

Or you can also use the actual fraction of the day
=Date()+(2.5/24)

Finally there is the TimeSerail function
=Date()+TimeSerial(2,30,0)

Cheers, Andrew
0
 
Jim P.Commented:
The Date() function returns the date only. Adding the time to it that way will always give you 2:30 AM.
?Date()+#2:30:00#
04/22/2009 2:30:00 AM 
?NOW()+#2:30:00#
04/22/2009 3:00:40 PM 

Open in new window

0
 
TextReportCommented:
Hi jimpen, agreed just using it as a simple exaple.
Cheers, Andrew
0
 
GreekiwiAuthor Commented:
Wow, woke up this morning and already had 7 replies. All very helpful. I have given points based on which one I used.
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

  • 2
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now