How It Works:
Input: The user enters a value for a specific time unit (e.g., seconds, minutes, hours, days, weeks, months, or years).
Conversion: The script converts the entered value into seconds (the base unit for time) and then converts it into the target unit.
Output: The converted value is displayed in the selected target unit.
Supported Time Units:
Seconds (s)
Minutes (min)
Hours (h)
Days (d)
Weeks (wk)
Months (mo) (approximated as 30 days)
Years (yr) (approximated as 365 days)
Conversion Logic:
The value entered in the input field is converted to seconds first, using the corresponding conversion factor for the selected "from unit."
Then, the script converts the value in seconds to the target unit using the conversion factor for the selected "to unit."
Example Conversion:
If the user enters 1 year in the "from unit" and selects "days" as the "to unit":
1 year = 365 days (approximately).
The script converts 1 year to 365 days.