KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Time Command String Format
PRODUCT: 4D | VERSION: 14.0 | PLATFORM: Mac & Win
Published On: August 11, 2014

The Time command can convert a string into a time expression. There are many formats of times, and how the Time command parses the strings is simple. It breaks the string into the first three numbers it can find separated by character other than an integer and those three become the Hours, Minutes, and Seconds in the respective orders.


As long as any character other than a number acts as a divider the first three numbers found will become the Hours, Minutes, and Seconds.


If there is no character acting as a divider, the string of consecutive numbers will become a whole entity for a unit of time.


If the value for minutes and seconds are greater than 59, the value is divided by 60 and increases the ascending unit of time value by one leaving the remainder as the value for the respective unit of time. Hours can continue to increase.




The string is also parsed for the string "pm" and if found and the Hours value is between 0 and 11, 12 hours will get added to represent the time based on a 24 hour time expression.


As long as the string"pm" is found the calculation is applied, even if the "pm" is contained within another string.

Thus the time command is very lenient when accepting strings to convert to a time expression.