Script to calculate the duration between two dates
Posted: 30 Sep 2024 12:47
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
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