Yes, this is a different approach.
Is there a way to order it in age by clicking on the column header, even though I am able to do so with a neighboring column?
It now orders based on the digit no matter the period name.
Age based on minutes
Re: Age based on minutes
Code: Select all
$mins = datediff(property("#date.m", <cc_item>), , "n");
$days = regexreplace($mins / 1440, "[.,]\d+$");
if ($days != 0) { $mins -= $days * 1440; }
$hours = regexreplace($mins / 60, "[.,]\d+$");
if ($hours != 0) { $mins -= $hours * 60; }
return format($days, "0000") . ":" . format($hours, "00") . ":" . format($mins, "00") . " d/h/m";
One of my scripts helped you out? Please donate via Paypal
Re: Age based on minutes
...and there we go with the ugliness as stated earlier.
Ralph
(OS: W11 22H2 Home x64 - XY: Current beta - Office 2019 32-bit - Display: 1920x1080 @ 125%)
(OS: W11 22H2 Home x64 - XY: Current beta - Office 2019 32-bit - Display: 1920x1080 @ 125%)
Re: Age based on minutes
He asked for a sortable way and this kind is the only thing that works *sigh*
Format it differently if you like...
Format it differently if you like...
One of my scripts helped you out? Please donate via Paypal
Re: Age based on minutes
Hey highend, nice use of compound assignment operators.
Windows 11, 23H2 Build 22631.3447 at 100% 2560x1440
Re: Age based on minutes
We got them, let's use themHey highend, nice use of compound assignment operators.
One of my scripts helped you out? Please donate via Paypal
Re: Age based on minutes
I'm fully aware that the ugliness is needed here in order to make the column sortable - as I pointed out in an earlier post.
I don't need this myself just trying to help as you are and I'm quite happy with regular date columns (sortable however I want) and if I need an interpretation in weeks, days hours... I hover the date of interest to see exactly this and more in the tooltip that pops up.
Ralph
(OS: W11 22H2 Home x64 - XY: Current beta - Office 2019 32-bit - Display: 1920x1080 @ 125%)
(OS: W11 22H2 Home x64 - XY: Current beta - Office 2019 32-bit - Display: 1920x1080 @ 125%)
Re: Age based on minutes
Is there a way to combine the two solutions that were given.
To make ordering working using the last code by Highend, but it shows sec(s), min(s), hour(s), day(s), week(s) in the list, the code given by Highend in the message before.
Bart
To make ordering working using the last code by Highend, but it shows sec(s), min(s), hour(s), day(s), week(s) in the list, the code given by Highend in the message before.
Bart
Highend outside this forum
Re: Age based on minutes
And how exactly should these entries look like?
One of my scripts helped you out? Please donate via Paypal
Re: Age based on minutes
Using your last code to get the age and if it falls in a range then mention: if less than a minute mention the seconds, otherwise if less than an hour mention the minutes, etc. You think this logic is workable?
This is a sample from the format Age:
This is a sample from the format Age:
- Attachments
-
- 2018-11-04 21_43_31-C__Users_Bart_Dropbox_Business Documents_Pictures, Screenshots_Business Pictures.jpg (31.18 KiB) Viewed 941 times
Last edited by Bart on 04 Nov 2018 15:46, edited 1 time in total.
Highend outside this forum
Re: Age based on minutes
Show real world examples and don't try to explain concepts...
One of my scripts helped you out? Please donate via Paypal
Re: Age based on minutes
Well, exactly how it is shown using the code that I gave in one of my last posts but with the ability to order it using the column header.
Highend outside this forum