Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Php time adjustment problems

  • 07-09-2002 4:04pm
    #1
    Registered Users, Registered Users 2 Posts: 15,540 ✭✭✭✭


    Am trying to adjust the time reported on a site i'm currently working on and am running into difficulties.

    I've put the code below in which works fine for the current time (reported in $g_complete_date_format ) but $g_normal_date_format is used for recorded messages however the "time()" part of it is pulling the current time from the server not the recorded time.

    If i leave it as $g_normal_date_format = "d-m H:i" then its reporting the correct times ..bar the fact that they are 9 hours ahead of the current timezone here.
    Anyone got suggestions? , i've read over the stuff on sourceforge..but my brain seems to have gone to mush today and cannot figure it out :(

    CURRENT INCORRECT CODE :(

    $hourdiff = "-9"; // hours difference between server time and local time
    $timeadjust = ($hourdiff * 60 * 60);
    $g_short_date_format = "d-m";
    $g_normal_date_format = date("d-m H:i",time() + $timeadjust); <<<<<<<
    the time() is incorrect !!
    $g_complete_date_format = date("d-m Y H:i",time() + $timeadjust);

    Thanks.

    <edit>didn't see there was a php forum now, mods, sorry for posting in the wrong place, please move</edit>

    Have a weather station?, why not join the Ireland Weather Network - http://irelandweather.eu/



Comments

  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    Works fine for me. Try putting paranthesis around the time adjustment:

    date("d-m H:i", (time() + $timeadjust));

    adam


Advertisement