I have found a solution that worked for me. It was provided by an Intel Community Employee and involves deleting system registry keys.
***Please make a backup by Export to .reg file, before deleting. As making incorrect changes to the Registry may cause issues to Windows and may cause programs crashing or no longer start***
Press "Windows+R" to open the run window, enter 'regedit', find the path HKEY_CURRENT_USERS\Software\ModelTechnology Incorpporated\Modelsim, and delete all the folders.
I also uninstalled quartus and modelsim before I ran this process then restarted my computer then reinstalled quartus and modelsim.
I don't know if the uninstalling and reinstalling was necessary but after that I no longer got the invalid time string issue.
As expected, it was not a code related issue or even a Quartus/modelsim version issue as I tried upgrading to the most recent quartus and using questa rather than modelsim but I still ran into the same error.