Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

THEMA: Customize timestamp

Customize timestamp 9 Monate 3 Wochen her #100559

  • dmoci
  • dmocis Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 3
  • Karma: 0
Hi,
is it possible to customize the timestamp?

I need to be able to analyze my data by year, month and weekday to something like
13-03-2
(standing for 2013, March, Tuesday).
It would be best to have the three values as separate variables in the data set.

For privacy reasons I cannot save the whole timestamp because every more exact time information (day, hour, minute...) would allow for identifying individual people. I have the impression that the Expression Manager could help me, but I am not an experienced programmer and so don't really understand how to use that.

Help is very much appreciated! Thanks in advance.
dmoci
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Customize timestamp 9 Monate 3 Wochen her #100561

  • mfaber
  • mfabers Avatar
  • OFFLINE
  • Expert Lime
  • Beiträge: 82
  • Dank erhalten: 21
  • Karma: 4
It's not a big problem to extract these data from an existing timestamp. You could use the following function {date("Y-m-w",strtotime(yourdate))}.

Where does this date come from? Is it collected using a date/time question? Or is it the date the survey was taken?

To be able to lead you in the right direction: Would it be ok to collect the full date, extract the components you need and only export those? Or do you need, for data protection reasons, a solution where only these data are COLLECTED? And: what is your Limesurvey version?
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Customize timestamp 9 Monate 3 Wochen her #100562

  • dmoci
  • dmocis Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 3
  • Karma: 0
Thanks for your quick reply, mfaber! Your last assumption is right: For data protection reasons I may only COLLECT the year/month/weekday-component of the timestamp. I may not save any more information in the data set. So I probably would have to call the function you specified for extracting these components from the timestamp before writing the data to the data set (however this can be done). The date I am interested in is the date the survey is taken. How this is collected (timestamp or a somehow hidden date/time-question) is not important to me as long as it is collected automatically (i.e. no user input).
I am using the latest version of limesurvey.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Customize timestamp 9 Monate 3 Wochen her #100563

  • mfaber
  • mfabers Avatar
  • OFFLINE
  • Expert Lime
  • Beiträge: 82
  • Dank erhalten: 21
  • Karma: 4
ok, cool...
You'll create a new question, equation type. In the question text you'll put
{date("Y-m-w",strtotime("now"))}.

It'll show you todays "date" as "13-10-2". The 2 is for wednesday cause it starts counting from 0. This information will then be collected automatically and saved much like a user response in the database.

Test it...if it works as expected you can also hide the question. Lastly, when activating the survey have the survey timestamp, ip-address etc. deactivated so no user identifiable information is collected. You should be good to go.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Folgende Benutzer bedankten sich: dmoci

Customize timestamp 9 Monate 3 Wochen her #100564

  • mfaber
  • mfabers Avatar
  • OFFLINE
  • Expert Lime
  • Beiträge: 82
  • Dank erhalten: 21
  • Karma: 4
Oh yes...should you require any other date components...such as the week number, month, etc., you can find the whole list of available options here:
php.net/manual/en/function.date.php
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Folgende Benutzer bedankten sich: dmoci

Customize timestamp 9 Monate 3 Wochen her #100570

  • dmoci
  • dmocis Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 3
  • Karma: 0
This works perfect, just as I need it. Thanks a lot!
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Moderatoren: ITEd
Ladezeit der Seite: 0.150 Sekunden
Donation Image