Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Show date instead of "Hours ago" etc

2»

Comments

  • ... said the guy who puts the exact date he is posting at the bottom of each comment. :P
  • <OnlineGameMode>LOL, pwned Wanderer :P</OnlineGameMode>
  • Touche!
    I do that so you know what time it is at this end!

    Posted: Saturday, 13 January 2007 at 4:36PM (Australian Eastern Daylight Savings Time)

  • I'm so glad you linked this thread, absolutely fantastic self-ownage :-)
  • My server is two hours off - can someone help me reformat the date?
  • This is a script I use on my forum.
    I live in Melbourne, the forum is hosted in the US, time difference = 14 hours...

    <?php $serverdate = date("l, d F Y h:i a"); echo 'Unadjusted Server Date: <b>'.$serverdate.'</b>'; echo ' &nbsp; <p>'; // 14 = hours difference between server time and local time $timeadjust = (14 * 3600); $melfullbdate = date("l, n M Y h:i a",time() + $timeadjust); $month = date("M",time() + $timeadjust); $day = date("j",time() + $timeadjust); echo '<pre>Month & Day for Script:.......... '.$month.' '.$day; echo '<br>Full Melbourne Date:............. '.$melfullbdate .'</pre>'; ?>
    I hope it helps.

    Posted: Tuesday, 17 April 2007 at 7:59AM

  • edited April 2007
    I've got something a little weird that I can't quite explain.

    We've got two installs of the forums using the one database. the older one can be found here: lansmash.com/v and the newer one here arena.lansamsh.com/v/

    The newer installation thinks it's 10 hours ahead of the older one, but I can't figure out where in the code it's getting the change from!
  • edited April 2007
    @jroos
    My method is add date_default_timezone_set() in the conf/database.php (it makes all database's time correct.)
    My forum's member are live in Taiwan, so I add date_default_timezone_set('Asia/Taipei'); after the <?php
    Since my forum hosted in USA, time different 16 hours (Taiwan's hour - USA's hour = 16), it will have some problems in account profile.
    So I edit the themes/account_profile.php and themes/search_results_users.php, find any mktime() and change to mktime(date('H')-16).
    example:
    Change <p>'.TimeDiff($this->Context, $this->User->DateFirstVisit, mktime().'</p> to <p>'.TimeDiff($this->Context, $this->User->DateFirstVisit, mktime(date('H')-16)).'</p>
  • so for being a pain in this thread . . . If I replace line 94 in comments.php as mentioned by minisweeper: <span>'.$this->Context->GetDefinition('CommentTime').'</span>'.date('F dS Y h:i:s A', $Comment->DateCreated); The time is 2 hours off. Then I added date_default_timezone_set('America/New_York); to the database.php in conf. So it fixed the issue - but all previous posts will be 2 hours off.
  • [..] $Comment->DateCreated - 60*60*2 [..]
    and leave timezone as is
This discussion has been closed.