I have imported the XLS file into an Integer field. As expected, it ignored the am/pm.
Then I re-imported using a Text field and input the formula time(hh:mm) which is giving me an error a syntax error.
Where am I going wrong?
The time( function returns a number representing the time. The number is the number of seconds since midnight. If you have the XLS data in a text field you can have another integer field and use a formula to fill that field with time(myTextField) and it will convert the time as text to numeric values as time in seconds from midnight. You should not have to change the original XLS data at all since the time( function is smart enough to handle both AM/PM and 24 hour formats.
Rereading your original post I now see that you wanted to know how to turn that mixed list of variously formatted times into a common 24 hour format. Use this formula:
timepattern(time(«»),"hh:mm")
The time( function will first convert the original text time into a numeric value and the timepattern( function will then reconvert this back to the 24 hour formatted text.
Gary’s formula would have been used in a formulafill in a text field that already had times that were inconsistently formatted. If this formula is being used in the import dialog, you would need to have the column number between the «» chevrons.