Comparing Stop/Start Dates and Times with LLTK
Lab scientists need to record both a start and stop date/time for an incubation. As a second evaluation of how many hours the incubation lasted, the scientists want BaseSpace Clarity LIMS to calculate the elapsed time.
The Lab Logic Toolkit evaluateDynamicExpression script can compare date/time entries and calculate elapsed hours. As Date fields in the LIMS do not display the required time component for this calculation, Text fields are needed.
The bash command uses a 'Date' function to convert the Text date/time entries into dates, and also uses a 'getTime' method to convert those dates into milliseconds since 1 January 1970 00:00:00 UTC. The difference between the two converted entries is then changed from milliseconds to hours.
Create a step level Text field for the Start Date/Time.
In this example, the field is named Incubation Start yyyy-mm-dd hh24:mi. The format is included in the name to assist the scientist entering the date/time.
Create a step level Text field for the Stop Date/Time.
If you want to use a button to populate a Text field with the current date/time, then use: