Welcome to the LimeSurvey Community Forum

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

Date in pdf report

  • torilee93
  • torilee93's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 3 months ago #225957 by torilee93
Date in pdf report was created by torilee93
LimeSurvey version:  LimeSurvey Community Edition
Version 5.3.3+220307
Own server or LimeSurvey hosting: Own server
Survey theme/template: Vanilla Theme
==================

Hello,
We have recently had a user tell us that our pdf report is entering the incorrect date. She said she completed the survey on 3/3/22 at 11:50 PM but the report showed she completed it on 3/4/22 at 11:50 PM. So far it has only been one user that reported this. 

I checked the server date and it is correct and I am using the code {date("F d, Y")} in my pdf report. Is this incorrect?

Thanks for your help!
- Tori

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 3 months ago #226004 by holch
Replied by holch on topic Date in pdf report
By any chance, this user was not from the US? I find it hard to believe that Limesurvey will write the wrong date, if so, it would be for everyone.

However, I think the problem lies in the date format. Most of the world has the day before the month, but in the US you are using Month, Day, Year. My guess would be that this confused the respondent.

In any way, you can easily test if the date is wrong by testing your survey and see what date is written to the PDF report.

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.

Please Log in to join the conversation.

  • torilee93
  • torilee93's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 3 months ago #226088 by torilee93
Replied by torilee93 on topic Date in pdf report
Thanks for your input! The user is from the US. Now I'm noticing that the users that have the night shift seem to have wrong dates. (Is a day ahead) but the morning shift users have the correct date. Very strange. I have the date set up to print out the Month, day, and year. So for today it would print out as March 09, 2022 to prevent confusion.

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 3 months ago #226089 by holch
Replied by holch on topic Date in pdf report
Have you checked the time of the server?

Limesurvey uses the time of the server, which can be totally different to the local time of the respondent.

Here an example: My server is located in Germany, but most of my users and respondents would be from Brazil. However, Limesurvey takes the system time, because it doesn't really know the local time of each respondent.

Limesurvey has the option to change this date and adapt it to your local time. e.g. can correct the system time of the server by X hours to match the local time here. However, if someone from Australia responds one of my questionnaires, the date would still be the system date/time +/- the correction in Limesurvey.

For the US: As you guys have so many time zones from East to West, this can have an impact. E.g. if the server is on EST and the respondent on PST there is already quite a difference in time and for the night shift possible also in date.

With this, one will always suffer. Either the respondent or the one that is the owner of the software. Maybe you can try to save both times, the time when Limesurvey received it, via the (corrected) server time and maybe via Javascript the time on the side of the respondent. Not sure if this is possible, but I think it should be possible to use the time of the respondent's device and save it in a hidden question.

My bet would be that javascript gets the time from the machine/browser of the respondent, not of the server. Something like that:
www.w3docs.com/snippets/javascript/how-t...e-in-javascript.html

Not sure if this is the problem though, but I can imagine it is, given that it is a problem mainly for the night shift.

The correction of the server time can be found under "Configuration" --> "Global (Settings)" --> General --> "Time difference (in hours)".

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.
The following user(s) said Thank You: DenisChenu, torilee93

Please Log in to join the conversation.

  • torilee93
  • torilee93's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 3 months ago - 3 years 3 months ago #226094 by torilee93
Replied by torilee93 on topic Date in pdf report
Thanks. I do see under the "Time difference (in hours)" it has a "-5" for corrected time. Not sure if this is causing the issue. I do want the corrected time instead of the server time, I would think that the -5 is supposed to correct this?
 
Attachments:
Last edit: 3 years 3 months ago by torilee93. Reason: Broken image

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 3 months ago - 3 years 3 months ago #226095 by holch
Replied by holch on topic Date in pdf report
Yes, obviously the person who set up the Limesurvey installation corrected the server time by 5 hours.

So according to your screenshot, the current time of the server was 20:51 at the time, which was corrected by 5 yours to 15:51. If 15:51 is YOUR time, or the time you want to have, then this is correct. But only you can know.

In any way, if your respondents are in a different time zone than the one you have set, there will still be a certain difference.

An other aspect is to check if the PDF report takes the corrected date or the server date. Not sure how this is handled. It also depends on where the PDF report comes from. Is it a plugin?

Because I am not 100% sure what the correction does. Is the date still saved in the database based on the server system time and only corrected on display in Limesurvey? How does the PDF report get the date and from where. So there are quite a few open variables that need to be checked.

What date is shown on the PDF report, when you test it? The Server time or the corrected time?

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.
Last edit: 3 years 3 months ago by holch.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 3 months ago - 3 years 3 months ago #226097 by Joffm
Replied by Joffm on topic Date in pdf report
Hi,
I was always thinking, Tori speaks about the plugin pdfReport.

So, what do you want to display?
The server time, your local time, the local time of the participant
your local time you will get by the correction of the server time,
the local time of the participant you can get by a javascript snippet in a hidden question.
Like this
Code:
<script>
const months = ["January","February","March","April","May","June","July","August","September","October","November","December"];
const d = new Date();
let dd = months[d.getMonth()] + ' '+d.getDate() + ', '+d.getFullYear();
$('#question{QID} input[type="text"]').val(dd);
</script>

Then you do not use {date('F d,Y')} but the reference to this question and will get the time of the participant's device, even if it is absolutely wrong.

Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 years 3 months ago by Joffm.

Please Log in to join the conversation.

  • torilee93
  • torilee93's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 2 months ago #226657 by torilee93
Replied by torilee93 on topic Date in pdf report
Hi,

Yes, I was speaking about the plugin pdfReport. I would like my local time to show. I have the correction of server time and it seems to work out correctly until a user submits a survey at night (around 11 pm) then the time captures correctly but it puts the date into the future.

For example, the user submitted the survey at 11:48 PM on march 23, 2022 but the survey records it as she completed the survey at 11:48 PM on march 24, 2022.

- Tori

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #226659 by Joffm
Replied by Joffm on topic Date in pdf report
Hi, Tori,
would you please send a small sample as lss.
I do not want to create something that might be different from yours.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #226661 by holch
Replied by holch on topic Date in pdf report

For example, the user submitted the survey at 11:48 PM on march 23, 2022 but the survey records it as she completed the survey at 11:48 PM on march 24, 2022.


This sounds odd. In my opinion there are only 2 possibilities for this error to occurr:

1. The time correction in Limesurvey is faulty (it displays the corrected hours, but it takes the uncorrected date)
2. There is a problem with the time on your server.

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #226665 by tpartner
Replied by tpartner on topic Date in pdf report
Other side of the date line? :)

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #226668 by holch
Replied by holch on topic Date in pdf report

Other side of the date line? :)


But even then, it wouldn't jump 12h ahead at once, would it? I am confused.

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose