Bienvenue, Invité
Nom d'utilisateur : Mot de passe : Se souvenir de moi

SUJET : Calcuations with time data

Calcuations with time data il y a 9 mois 6 jours #100958

Hello,

I am creating a survey to look at sleep and need to know bed times and get up times. I would like to be able to provide people with feedback about their sleep such as sleep duration. To do this I need to do some simple calculations with the times they provide. I have made questions with hour and minute drop down boxes, but can't figure out how to do the calculations. In excel I would use: wake time +(24-bed time). Is there a way to do this is LimeSurvey?

Thanks
L'administrateur a désactivé l'accès en écriture pour le public.

Calcuations with time data il y a 9 mois 6 jours #100962

  • mfaber
  • Portrait de mfaber
  • Hors ligne
  • Expert Lime
  • Messages : 82
  • Remerciements reçus 21
  • Karma: 4
You may be able to do this using the function strtotime(). It's fairly new in LS and seems to work well with dates. I have not tested it myself to work with times but in principle it should work. Have a look here:
manual.limesurvey.org/Expression_Manager...ce_between_two_dates
and here:
www.php.net/manual/en/function.strtotime.php

Please be aware that strtotime() works with a lot of different but not ALL date formats. Limesurvey's default date format (MM-DD-YYYY) does NOT work with strtotime(). Please set your survey to use one of the following date formats to avoid problems: YYYY-MM-DD, YYYY/MM/DD, DD.MM.YYYY, MM/DD/YYYY, DD-MM-YYYY.
For times, you are probably on the safe side using HH:MM
L'administrateur a désactivé l'accès en écriture pour le public.
Cet utilisateur a été remercié pour son message par: kateporcheret

Calcuations with time data il y a 9 mois 6 jours #100963

  • Ben_V
  • Portrait de Ben_V
  • Hors ligne
  • Platinum Lime
  • Messages : 1061
  • Remerciements reçus 234
  • Karma: 74
hi,
if you want to go further with time calculation it may be better to retrieve times using just one (numerical) question.
Have a look here to get another approach using a 'timepicker' question
Benoît

goo.gl/Bw5iM => Recherche GG dans le forum français (remplacer "exemple" dans la barre de recherche)
goo.gl/WX8PH => GG search for english forum (Replace "example" in the search bar)
goo.gl/IxiGu => Búsqueda en el foro en español (Cambiar "ejemplo" en la barra de...
L'administrateur a désactivé l'accès en écriture pour le public.
Cet utilisateur a été remercié pour son message par: kateporcheret
Modérateurs: ITEd
Temps de génération de la page : 0.144 secondes
Donation Image