Calculated field using time (1 Viewer)

GingGangGoo

Registered User.
Local time
Yesterday, 17:00
Joined
Dec 14, 2010
Messages
121
Access 2013 Web App:

I have an activity start time and end time and would like to calculate elapsed time. How do I set this up in a calculated field on the table. While I am on the subject, is there a way to use a date field calculation to return the name of a month, not it's #.
Thanks
 

bob fitz

AWF VIP
Local time
Today, 01:00
Joined
May 23, 2011
Messages
4,726
Access 2013 Web App:

I have an activity start time and end time and would like to calculate elapsed time. How do I set this up in a calculated field on the table. While I am on the subject, is there a way to use a date field calculation to return the name of a month, not it's #.
Thanks
Others here may disagree, but I would not use a calculated field at the table level. I would do the calculation in a query.
Perhaps the DateDiff() function would be of use. See: http://www.techonthenet.com/access/functions/date/datediff.php
 

GingGangGoo

Registered User.
Local time
Yesterday, 17:00
Joined
Dec 14, 2010
Messages
121
Others here may disagree, but I would not use a calculated field at the table level. I would do the calculation in a query.
Perhaps the DateDiff() function would be of use. See: http://www.techonthenet.com/access/functions/date/datediff.php

Yes that would be the best practice, but I am having trouble getting a calculated field to work in my query. If i'm looking at this right I need to modify this: DateDiff('d',#15/10/2003#,#22/11/2003#) to calculate the time in minutes between Endtime and StartTime. So 'd' would be 'n' for minutes right? but do I replace the dates with [Endtime],[StartTime]?
 

GingGangGoo

Registered User.
Local time
Yesterday, 17:00
Joined
Dec 14, 2010
Messages
121
Aha! I got it to work! Using Jeff Conrads book, I wrote the expression as:
DateDiff(Minute, [StartTime], [EndTime]. I guess the Web App takes the whole name of time/date parts, rather than symbols. Go figure

Now how to get it to show time like this: 1.5 hrs? If I do it as minute, 2 hrs gives me 180, but how do I divide it? If I do it as hour, I get 2 hrs fine, but what if it's 1.5 hrs?
 
Last edited:

bob fitz

AWF VIP
Local time
Today, 01:00
Joined
May 23, 2011
Messages
4,726
If you get it to return a value in minutes and then divide it by 60
 

bob fitz

AWF VIP
Local time
Today, 01:00
Joined
May 23, 2011
Messages
4,726
Maybe: DateDiff(Minute, [StartTime], [EndTime])/60
 

Users who are viewing this thread

Top Bottom