Compute duration time in date/time format?

85 views
Skip to first unread message

Alberto Gz

unread,
Feb 1, 2018, 1:42:49 AM2/1/18
to mementodatabase
I'm building a database for time tracking, and need create a chart to add diff between start time and stop time.

My problem is result for field 'duration' is a string then can't compute it. I could have a extra field (hidden) for duration in milliseconds to compute duration along the days, but I want chart it showing as HH:mm minutes.

How I can build this?

Thanks

Bill Crews

unread,
Feb 1, 2018, 4:41:08 AM2/1/18
to Alberto Gz, mementodatabase
My problem is result for field 'duration' is a string then can't compute it. I could have a extra field (hidden) for duration in milliseconds to compute duration along the days, but I want chart it showing as HH:mm minutes.

Haven't done much charting, but if you have the milliseconds in a field, you can create a JavaScript field for display.

Assuming you have milliseconds in an Integer field called Duration, and for sharing, you need a string field Duration Display in HH:mm format.

Create the JavaScript field. Press Add JavaScript libraries. Check the box for moment.min.js. Use script...

moment(field("Duration")).format("HH:mm")

Alberto Gz

unread,
Feb 1, 2018, 10:39:15 AM2/1/18
to mementodatabase
Thank you for your reply Bill.

I can have one field in milliseconds as integer and other field in date/time format as string.

Problem is that I want compute its values in a Memento chart. If I choose compute field in integer data, computing is right, but units are in miliseconds on my chart. So is not easy redeable.

If I choose time field, data is string and can't computable.

In spreadsheets usually data can be integer or float but it can be display as string. Example cells formated as currency or date.

Bill Crews

unread,
Feb 1, 2018, 12:17:01 PM2/1/18
to Alberto Gz, mementodatabase
I bet the answer is within the charting facility in Memento, then. I wish I knew more about it.

Alberto Gz

unread,
Feb 1, 2018, 1:31:44 PM2/1/18
to mementodatabase
Here a screenshot of chart edit options. Sorry for my app us in spanish language.

When in values (valores) is selected a field that isn't numeric, function (función) is only number of entries for compute. That is logic, so strings can't be computed.

I don't see how I can to do that compute time values but show it in format like HH:mm in chart.

Bill Crews

unread,
Feb 1, 2018, 1:34:48 PM2/1/18
to Alberto Gz, mementodatabase
I have no idea, but hopefully someone else does.

Alberto Gz

unread,
Feb 1, 2018, 1:40:12 PM2/1/18
to mementodatabase
Thank you anyway!

Alberto Gz

unread,
Feb 1, 2018, 1:40:37 PM2/1/18
to mementodatabase
Reply all
Reply to author
Forward
0 new messages