Page 1 of 1

Format of time

Posted: October 22nd, 2023, 4:11 pm
by CMH
Hi
I am capturing the survey start time (ST) and end time using the following logic.

PROC ST
preproc
// Prefill field start time with current time.
if visualvalue($) = notappl then
$ = systime("HHMM");
endif

If survey starts at 8am, it provides time data as 800 when i export data in SPSS. I want to get data in time format like 08:00 (rather 800) so later on i may calculate time difference using "Date and Time Wizard" fucntion of SPSS as shown in a vidoe available at following link.

https://www.youtube.com/watch?v=NRL34hpK6-A

Any solution please.

Re: Format of time

Posted: October 22nd, 2023, 11:49 pm
by vicente
$=edit("99:99",systime("HHMM"));

Re: Format of time

Posted: October 24th, 2023, 3:39 pm
by CMH
Thanks. Its working.

Re: Format of time

Posted: February 21st, 2024, 10:03 am
by PHINOJOSA
Hi

The time format as indicated in the previous post works when we want it to be automatic, but if I want to manually enter the time with that format 14:12 (24 hour format) and if the time is 8:24 it autocompletes with 0 and it's 08:24, how can I do that?

I have tried but it doesn't work, I could only do it in a 4-digit string variable and put 1412 and indicating that the two digits on the left are the hour and the ones on the right are the minutes.

Thank you

Re: Format of time

Posted: February 21st, 2024, 6:29 pm
by justinlakier
Hello,

This is a different issue. If you want the manually entered time number to fit your format, I would recommend using Hour and Minute as separate fields. You can use Subitems for this, and put the items in the same block to be concurrently displayed on Android. You can then put in your specifications for the 24 hour format in those fields' logic.

Hope this helps,
Justin

Re: Format of time

Posted: March 20th, 2024, 10:53 pm
by PHINOJOSA
Hi

Thank you