Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Question about hidden time stamps and dates in SPSS

  • midnightking
  • midnightking's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 2 months ago - 3 years 2 months ago #212166 by midnightking
Hello, 

I have added a hidden time stamp in the comment box of my list with comment question.

I was wondering if there is any way to make it so that when I export my participant data into SPSS the time stamp can appear as a date type variable rather than as a string type variable?
Last edit: 3 years 2 months ago by midnightking.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #212173 by Joffm
Hi,
it's a bit late now.
You get the full "Date()" exported like "Thu Feb 18 2021 10:10:29 GMT+0100 (Mitteleuropäische Normalzeit)".
To store this you used 
Code:
$('#question{QID} textarea:eq(0)').val(new Date());

What do you need for your idea to find out when a question was asked? Only the time.
If you'd have stored only the time with 
Code:
          var currtime = new Date();
          var currtime = currtime.getHours() + ":"+ currtime.getMinutes() + ":" + currtime.getSeconds();       
          $('#question{QID} textarea:eq(0)').val(currtime);
you would have got still a string like "9:39:23".
But this you can switch to format "date" in SPSS with two clicks.

Other approach:
In your survey use some equations to extract the time from that "Date()" string, like {trim(substr(Q1_comment,16,8))}

These are LimeSurvey specific solutions.

Now the other way:
Compute it in SPSS
COMPUTE Q1_T=RTRIM(CHAR.SUBSTR(Q1_comment,17,8)).
EXECUTE.


This you can add at the end of your syntax file and everything is done while importing into SPSS.
Afterwards it is still a string. But with two clicks you can switch the format to "date".

Joffm

By the way:
I still think that this approach (with the hidden time) was really not the very best to find out the order of the random questions.

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #212183 by Joffm
Not only to say "not the best approach", but to show something.

In a last (hidden) question of type "multiple numerical input" set the default answers to
{(AF37.qseq-1)/3-1}
{(Af19.qseq-1)/3-1}
...
(This formula fits your provided survey. You may adapt it or just leave {AF37.qseq} ...)

Then you get the order of the questions 
 

Joffm

 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • midnightking
  • midnightking's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 2 months ago #212227 by midnightking
Replied by midnightking on topic Question about hidden time stamps and dates in SPSS
Thank you I am still piloting the survey. I will try your solutions and get back to you on their effectiveness.

Your help is very appreciated.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose