Change Log for the latest
XYplorer BETA version:
Code: Select all
v26.40.0303 - 2024-09-30 16:12
+ Scripting got a new function.
Name: Age
Action: Converts a number of milliseconds into a human-friendly age format.
Syntax: age(msecs, [maxfields=2], [sepfields=", "])
msecs: Number of milliseconds.
maxfields: Maximum number of fields.
Defaults to 2.
sepfields: Separator between fields.
Defaults to ", ".
Examples:
echo age(); //0 secs
echo age(1000642); //16 mins, 40 secs
echo age(1000642, 3); //16 mins, 40 secs, 642 ms
echo age(1000000642); //11 days, 13 hrs
echo age(1000000642, 5); //11 days, 13 hrs, 46 mins, 40 secs, 642 ms
echo age(1000000642, 5, " & "); //11 days & 13 hrs & 46 mins & 40 secs & 642 ms
// age() can be nicely combined with datediff() using the ms (milliseconds) interval:
echo age(datediff("2008-08-08", , ms)); //16 years, 1 month before now (2024-09-30)
Remarks:
Months are a tricky unit here because they have different lengths. This is solved
by using an average length of a month of 30.436875 days (365.2425 / 12).
Note that the results of this strategy are sometimes counterintuitive when
the input is in the form of calendar dates:
echo age(datediff("2024-08-08", "2024-09-09", ms)); //1 month, 2 days
echo age(datediff("2024-09-08", "2024-10-09", ms)); //1 month, 1 day
To easily
upgrade to this BETA version from XYplorer, hold down the
CTRL key while you click
Help | Online Support | Check for Updates. If you prefer to
download the BETA version, choose one of these packages:
(1)
Installer Package, (2)
No-Install Package (for manual unpacking).
Note that BETA versions are work in progress and may contain new bugs. You have been warned. It's a good idea to backup your complete XYplorer settings (File | Settings Special | Backup Application Data Folder...) before running a new BETA. This will also help to fix any new bugs.