Welcome to Geeklog, Anonymous Monday, December 23 2024 @ 01:58 am EST

Geeklog Forums

Help with local time!!


zullop

Anonymous
Hi all, I need some help here setting the local time Frown( These are the strings from my config.php: $_CONF['language'] = 'english'; $_CONF['locale'] = 'en-gb'; $_CONF['date'] = '%A, %B %d %Y @ %I:%M %p %Z'; $_CONF['daytime'] = '%m/%d %I:%M%p'; $_CONF['shortdate'] = '%x'; $_CONF['dateonly'] = '%d-%b'; $_CONF['timeonly'] = '%I:%M %p %Z'; $_CONF['default_charset'] = 'iso-8859-1'; What do I need to have the time stamp at +9 hours? Many thanks in advance.
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany

Geeklog will always use the date and time of your webserver. See the timezone hack and related discussions.

bye, Dirk

 Quote

zullop

Anonymous
Thank you very much Dirk! Smile Now is ok, thanks a lot.
 Quote

Anonymous

Anonymous
The hack works great, but he's incorrect in saying it only works with safe_mode turned off. If you're on a shared server, you can ask your webhost to add TZ (if they haven't already done so) as an allowable environment variable to the php.ini file like this: safe_mode_allowed_env_vars = TZ Once they do, the hack works fine with safe_mode on. You'll need to drop this part of the if statement though: && !ini_get("safe_mode"Wink. If your ISP won't add TZ, then safe_mode must be turned off to use this hack.
 Quote

zullop

Anonymous
hi, it works, now the date format is correct but I found another problem Frown Posting a news, link, or whatever, it won't show up! I check the date posting and it was ok, but when the story has been created it says that is +1 day so it will not show up till that time Frown((
 Quote

Anonymous

Anonymous
Yes, unfortunately, this is only a partial fix. Those other areas still use the server time and aren't readjusted with this hack.
 Quote

zullop

Anonymous
so it means that who has the server in the other side of the world (as my case) cannot post stories?! Really bad that there is no fix yet Frown Thanks anyway guys.
 Quote

Anonymous

Anonymous
You can still post stories, but if your server's timezone is behind yours and want a story to show up immediately then you'll need to readjust the time you set in the story editor. It's kind of pain, but I think all the CMS' have this same problem. Seems like most people have their server in a different timezone. Luckily, mine is only one hour behind me not like yours.
 Quote

Status: offline

rv8

Forum User
Regular Poster
Registered: 10/10/02
Posts: 105
Location:Ottawa, Canada
What about a hack to rip out the code that checks the story date and time before deciding whether to post it or not? I suspect many users don't need the feature where GL doesn't post future stories. I know that I always want my story to post as soon as I post it. I'm lucky that my server is in the same timezone I am - otherwise I would be looking to use the timezone hack, and to find a way to enable GL to post future stories.---Kevin
Kevin Horton
 Quote

zullop

Anonymous
Guys, I will really appreciate if some of you will have an answer for this problem... I have to leave the US settings, with -9 hours and the american date format... it looks a bit strange when posting new stories Frown I hope some genious berween you guys, will come up with some workaround about this issue Wink ciao!
 Quote

Anonymous

Anonymous
You don't have to keep American date and time format. I live in the U.S, but I prefer the format used by the rest of the world and use it on my site. These lines here in config.php determine the default format presentation:

$_CONF['date'] = '%A, %B %d %Y @ %I:%M %p %Z';
$_CONF['daytime'] = '%m/%d %I:%M%p';
$_CONF['shortdate'] = '%x';
$_CONF['dateonly'] = '%d-%b';
$_CONF['timeonly'] = '%I:%M %p %Z';

On this page here, is a listing of the % meanings. Just change them to the way you want the date and time to appear on your site.

Example:

'%A, %B %d %Y @ %I:%M %p %Z' = Saturday, February 15 2003 @ 7:50 pm EST

Change it this or whatever other way you want:

'%d %B %Y %H:%M'; = 15 February 2003 19:50

You can move the symbols around or choose different ones on that page list.

Warning: If your server is running Windows IIS, it will not recognize these symbols: %C, %D, %e, %g, %G, %h, %n, %r,%R, %t, %T, %u, and %V.
 Quote

Status: offline

Eddy

Forum User
Newbie
Registered: 10/18/02
Posts: 10
Actually at the moment there is a temporary fix for what most of us facing, timezone problem. I followed the instruction in this post and hey, voila! My display even my posts all displaying the correct time of my local time! Eventhough when posting the time showed my server time which is -14, but after it is saved it shows +14... ahhh.... go ahead try it!
 Quote

Anonymous

Anonymous
Hey, thanks for pointing this out.
 Quote

Status: offline

doniking

Forum User
Newbie
Registered: 07/12/05
Posts: 1
This was what I've done with my geeklog site to adjust the time with my local time.

first open geeklog_dir/config.php

add this variable

Text Formatted Code

// your difference time with server time (in hour)
$_CONF['difference'] = '11';


 


then open geeklog_dir/public_html/lib-common.php

find this function

function COM_getUserDateTimeFormat( $date='' )



add this line:

$stamp = $stamp + ($_CONF['difference']* 60 * 60);

and the function will become:

Text Formatted Code

function COM_getUserDateTimeFormat( $date='' )
{
    global $_TABLES, $_USER, $_CONF;

    // Get display format for time

    if( $_USER['uid'] > 1 )
    {
        if( empty( $_USER['format'] ))
        {
            $dateformat = $_CONF['date'];
        }
        else
        {
            $dateformat = $_USER['format'];
        }
    }
    else
    {
        $dateformat = $_CONF['date'];
    }

    if( empty( $date ))
    {
        // Date is empty, get current date/time
        $stamp = time();
    }
    else if( is_numeric( $date ))
    {
        // This is a timestamp
        $stamp = $date;
    }
    else
    {
        // This is a string representation of a date/time
        $stamp = strtotime( $date );
    }

// ADD THIS
$stamp = $stamp + ($_CONF['difference']* 60 * 60);

    // Format the date

    $date = strftime( $dateformat, $stamp );

    return array( $date, $stamp );
}



 
 Quote

All times are EST. The time is now 01:58 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content