I have a form input that accepts time interval strings such as "1 day", "3 weeks", "2 months, 10 days" etc and converts them to integer representations of the total seconds, so "1 day" becomes 86400.
Now I need to be able to retrieve the integer and convert it back to a formatted string to be editable.
I've tried playing around with DateInterval but I've not had much luck. Besides, from what I gather that would restrict me to only displaying it in one format, so it could show "3 days" or "58 days".
Anyone know a script that can convert a duration timestamp to the most appropriate interval format string?