• Resolved ToniMa

    (@tonima)


    Hi there,

    another little issue i found is, that the time (i made it like you advised in FAQ) with UNIX_TIMESTAMP, but it does not use the locale time zone from WordPress config.

    you can check it on my homepage

    and here goes the query for the eg temperature:
    SELECT unix_timestamp(time_stamp) as time_stamp, value FROM netatmosphere_data_table where value_category = 'Temperature' and meter_location = 'outdoor' and time_stamp > curdate()

    that would be great, if you could use the time formatted according to the wordpress time zone.

    best regards,
    martin

    https://wordpress.org/plugins/wp-business-intelligence-lite/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi Martin,
    yes we’re fixing this in the next release.
    In the meantime you can fix it by replacing the exiting code with these lines in the concerned chart PHP file

    chart.xAxis
    .tickFormat(function(d) {
    var date = new Date(d);
    var dd = d + date.getTimezoneOffset() * 60 * 1000;
    return d3.time.format(‘” . $this->timeFormat . “‘)(new Date(dd))
    });

    Thread Starter ToniMa

    (@tonima)

    sry, i didnt got it, where to place this snippet. (to precise: what should i replace with that?)

    i am using your plugin the “official” way, that means i call it through shortcode. (only the small left in the widget calls directly get_html_4_chart with the chart id (also created “officially” through your plugin.

    so where do i place it? since it is looking like javascript should i update lineChart.js and append there the snippet in javascript format? but where?

    You have to look in the PHP file

    nvd3_lineChart.php

    under
    resources\nvd3\wrappers

    you have this code around line 102

    chart.xAxis
    .tickFormat(function(d) {
    return d3.time.format(‘%d/%m/%Y’)(new Date(d))
    });

    replace it with the code above

    Thread Starter ToniMa

    (@tonima)

    thx for the clarification!

    i tried it now, but it seems that its not 100% done with it.
    now i have got 2 hours difference. if i change it to that

    chart.xAxis
    .tickFormat(function(d) {
    var date = new Date(d);
    var dd = d - date.getTimezoneOffset() * 60 * 1000;
    return d3.time.format('" . $this->timeFormat . "')(new Date(dd))
    });

    (please recognize the minus!)

    br martin

    Did you check the actual time on your server? Is it correct?
    Otherwise you can always play with the formula to add/remove the 2 hours.
    add the minutes to the date.getTimezoneOffset() call
    (date.getTimezoneOffset() +- 120)

    Thread Starter ToniMa

    (@tonima)

    yep, the time configured is correct. lets say what i can see from wordpress settings.

    This has been fixed in the latest release.

    I have the code listed above, and the latest version of WP Business Intelligence Pro, but I’m still having the timezone problem. It displays UTC when it should be displaying EST, so my charts are always 4 hours off. Help me please? (My site is not published yet)

    Thread Starter ToniMa

    (@tonima)

    Hi claudio,

    same to me in the lite version (1.6.7).
    any ideas how to fix it?

    br martin

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Time display not in local timezone’ is closed to new replies.