1 (edited by ps21 2003-09-02 22:45)

Topic: Date Probem Maybe

I am sure this has been posted but I can't remember where. Suddenly all posts are showing up as Yesterday. I am posting this at 23.24 on 2nd September 2003. Have there really been no posts today.

Just a thought, has this got anything to do with time changes during the summer. My timezone is set to 00GMT. Of course at the moment the time is actually GMT+1 because it is summer "allegedly". On second thoughts, that would not explain it because it is now 22.24 GMT. Any ideas?

Just submitted this post and it tells me I posted it yesterday.

Edit again
This seems to be the same problem Fly had here except I am having the problem with this board rather than my own.

Re: Date Probem Maybe

Is it good now?

"Programming is like sex: one mistake and you have to support it for the rest of your life."


Re: Date Probem Maybe

Yes it is. I assume thats because you are one hour ahead of me so between 11pm and midnight my time we were on different days.

Re: Date Probem Maybe

Well, I just installed the fix I worked out when fly was having problems :) It will come with 1.1.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

5 (edited by ps21 2003-09-03 01:15)

Re: Date Probem Maybe

I don't suppose you would care to share the fix would you just in case I actually deploy a board prior to 1.1. I am quite happy hacking about with code if required. My guess is that the posting times were being adjusted according to users timezone but were then being compared with your server rather than users PC.

BTW. This will make you happy. I just installed a copy of Invision Board 1.2 on my own PC just out of curiousity. The pages of this board hosted on your server are actually loading faster than Invision Board installed on my own PC. That really is fast.

Re: Date Probem Maybe

Why, sure :) Just replace the current format_time() (in include/common.php) with this one:

// Format a time string according to $time_format and timezones
function format_time($timestamp, $date_only = false)
    global $cur_user, $options, $lang_common;

    if ($timestamp == '')
        return $lang_common['Never'];

    if (!isset($cur_user) || $options['server_timezone'] == $cur_user['timezone'])
        $diff = 0;
        $diff = ($cur_user['timezone'] - $options['server_timezone'])*3600;

    $timestamp += $diff;
    $now = time();

    $date = date($options['date_format'], $timestamp);
    $today = date($options['date_format'], $now+$diff);
    $yesterday = date($options['date_format'], $now+$diff-86400);

    if ($date == $today)
        $date = $lang_common['Today'];
    else if ($date == $yesterday)
        $date = $lang_common['Yesterday'];

    if (!$date_only)
        return $date.' '.date($options['time_format'], $timestamp);
        return $date;
"Programming is like sex: one mistake and you have to support it for the rest of your life."


Re: Date Probem Maybe

Thanks, much appreciated. I think I must be improving, I actually understand the code.