General information
Category:
Coding, syntax & commands
>I am looking for suggestions on the best possible way to compute elapsed time.
>
>Presently, on the input screen I have chosen to collect in separate fields the start date, time, am or pm, end date, time am or pm. Once the individual fields are provided I want to place the vales into a field type of 'date/time' to compute the elapsed time. I am having difficulty placing the separate fields into a field type of date time. Can you provide me with the syntax necessary to concatenate the individual fields into 'date/time' fields or suggestions on the best possible way to compute the elapsed time?
>
>I chose to enter into separate fields to prevent the user from formatting the date/time as required when entering into a field type 'Date/time'. example to enter 6/1/00 @ 3:00 am the user would be required to type 06/01/2000 03:00 AM. Entering the extra zeros to maintain the formatting requirement would slow down data entry. Is this a correct assumpation or is there a way to format the field for quick data entry into a 'date/time' field? The screen I am designing will be used for time card entry.
>
>Thank you for your input.
>
>Gary
Try putting the time together as a character string with all of the proper zeros using padl() and spaces (important!) then convert it to datetime with ctot(). A quick test using the time you supplied above worked in the command window.
ex.
? type("ctot('06/01/2000 03:00 AM')")
HTH,
Steve
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only