• Resolved riru90

    (@riru90)


    Hello, everyone,
    I use HD Quiz with a lot of fun. however, I run into a problem, I use WordPress with the time zone Amsterdam. however, in the HD Quiz results the date/time format, does not match my time zone Amsterdam.
    I just made the quiz 06-15-2020 05:48:33 pm (Amsterdam time) but the results indicate the next date/time at 06-15-2020 03:48:33 pm.

    How can I set the results to match the WordPress time I entered (Amsterdam time zone)?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Harmonic Design

    (@harmonic_design)

    Hi riru90,
    it looks like your server is set to GMT0 (default Greenwich Mean Time). The Save Results Light addon (which, in the future, please use the dedicated forum for that addon plugin – makes support easier) currently does not use WordPress’ timezone, but instead uses your server’s timezone. A future update to the addon will attempt to use the WordPress timezone first, and the server timezone as a fallback.

    If you want, for now, you can edit the addon plugin to manually set the timezone by copy/pasting a single line of code.

    From you admin area, go to plugins -> plugin editor. From there, select the Save Results Light addon from the dropdown on the top right. Now navigate to ./includes/functions.php file.

    On lines 60 and 61, you will see:

        // save the date and time
        $result->datetime = date('m-d-Y h:i:s a', time());

    replace this with:

        // save the date and time
        date_default_timezone_set('Europe/Amsterdam');
        $result->datetime = date('m-d-Y h:i:s a', time());

    The only change to the above code is the inclusion of date_default_timezone_set('Europe/Amsterdam'); which will tell PHPs date function to use the Europe/Amsterdam timezone.

    Thread Starter riru90

    (@riru90)

    Hello,

    Thanks for the update, glad to hear that in a plugin update it will be possible to first use the WordPress time for the server time.
    I will therefore wait for the update and not make any manual adjustments.

    Do you have any idea when this feature will be available?

    Thanks a lot for this good idea.

    If French people read this, they can modify like that:

    // save the date and time
    date_default_timezone_set(‘Europe/Paris’);
    $result->datetime = date(‘j M Y H:i:s’, time());

    And they will get that (Jul is to be sure it’s the month):

    9 Jul 2020 16:09:25

    For other date formats:
    https://www.php.net/manual/en/function.date.php
    https://www.php.net/manual/en/timezones.php

    I know it’s possible to write “Juil” but it’s not really necessary (too complicated, just for snobs admins or to display to hundreds of visitors…) : https://php.developpez.com/faq/?page=dates#date_jourfr

    • This reply was modified 5 years, 10 months ago by Michel.
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Date time format HD Quiz Results’ is closed to new replies.