Hi,
I would like to know if it is possible to script columns that could calculate the duration between two dates and then output that info into a column that would be displayed as age, e.g 2 years 5 months. I would use this in various ways such as for measuring a project duration, life-cycle of various items, how long an asset was held for, tenant move-in, move-out dates and that duration, and so on..
At the moment I'm currently using a duration calculator I found online (https://www.timeanddate.com/date/durationresult.html) and I'm manually placing the results into the comment column but I think automating this by way of XY scripting would be my preferred way to go if its possible, plus it would free up my comment columns for other info.
My thinking is to have "scripted column 1" get its beginning date from the created date and be displayed, e.g. 2024.09.30, then have "scripted column 2" be a manual input column that would be the ending date and hopefully it could have a similar pop-up option like the "touch created" feature of XY's for entry of this ending date, then finally have "scripted column 3" display the duration as age, e.g. 2 years 5 months.
Please let me know if this can be scripted and if so can you please help with this script. I have zero scripting knowledge.
Thanks
Script to calculate the duration between two dates
Re: Script to calculate the duration between two dates
Ofc this can be scripted (but not from me, I'm on vacation atm and I would have charged for it anyway)
One of my scripts helped you out? Please donate via Paypal
-
admin
- Site Admin
- Posts: 64915
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Script to calculate the duration between two dates
Interesting task. I added a new function age() to scripting that will make it easy.
Example (next beta v26.40.0303):
Example (next beta v26.40.0303):
Code: Select all
echo age(datediff("2008-08-08", "2024-09-30", ms)); //16 years, 1 monthFAQ | XY News RSS | XY X
Re: Script to calculate the duration between two dates
Okay, will look out for this in the next beta release.
By the way, I don't mind paying for custom scripts.
Thanks
By the way, I don't mind paying for custom scripts.
Thanks
-
admin
- Site Admin
- Posts: 64915
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Script to calculate the duration between two dates
It's already published: viewtopic.php?p=224286#p224286
FAQ | XY News RSS | XY X
XYplorer Beta Club