Wrox Programmer Forums
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 12th, 2007, 10:10 PM
Registered User
Join Date: Mar 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Calculate time

I am using
Format([START TIME]-1-[END TIME],"Short Time")
this calculates the total hours, and is working. However I need the time to be displayed in minutes any suggestions?
Old March 14th, 2007, 10:33 PM
Registered User
Join Date: Feb 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts

You need to use Format([START TIME]-1-[END TIME],"nn")
I think that you have to deduct start time from end time to get correct answer.
Ketan N Sharma
Old March 15th, 2007, 03:10 PM
Friend of Wrox
Join Date: Feb 2007
Posts: 163
Thanks: 0
Thanked 2 Times in 2 Posts

You are correct. You should subtract start time from end time to be accurate
Format is okay, but doesn't take into account differences greater than 59 minutes. What if there was 1 hour 40 minutes difference? 13:50 end time and 12:10 Start Time would return 40 minutes if you use FORMAT as specified even though 100 minutes has passed. I assume they want the value of 100 for that difference.

Assuming [Start Time] and [End Time] are date/time fields from the form bound table record, I would do this instead:

dim iTotalMinutes as integer
iTotalMinutes = ([End Time] - [Start Time]) * 24 * 60 'Note that dates are count of days when used as numbers

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to calculate elapsed time. RayL Access VBA 4 May 24th, 2007 12:04 PM
calculate a number between two dates in time t400 SQL Server 2000 8 September 5th, 2006 01:14 PM
Calculate Time sswingle Classic ASP Basics 1 April 10th, 2006 08:30 AM
calculate time between two dates RMorales2831 Access 1 February 13th, 2004 11:38 PM
Calculate time period dtaya Access 1 July 26th, 2003 07:26 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.