If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 1 of 1
  1. #1
    Senior Member
    Join Date
    Apr 2005
    Hatfield, England
    Member #
    I am trying to get the users timezone and convert the times on my site to their timezone. I am however having some trouble doing it. My site is based on phpbb and the time is stored in a decimal format. 00.00.00. So 1.00 would be an hour

    In my actual script..

    $postdate = strtotime($dbentry['postdate']);
    $date = date('j F Y, g:i a', $postdate); //Currently does very little
    $date = timezone($date);
    My function
    function timezone($date) {
    global $userdata;
    $timezone = $userdata['user_timezone'];
    $serverTime = "1.0";
    $difference = ($timezone - $serverTime);
    $date -= ($difference * 3600); 
    $ourTime = date('d/m/Y h:i:s',$date);
    echo $ourTime; 
    The function is supposed to take the date variable and convert it to the users timezone. Currently when i run it, there are no errors but the output is the 1/1/1970 time, instead of the current time +/- an hour.

    $timezone is a decimal 1.0, 2.0, based on how far ahead or behind GMT the user is.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
All times are GMT -6. The time now is 12:19 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: