TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,966
  • Latest: safir45
Stats
  • Total Posts: 195,993
  • Total Topics: 21,324
  • Online today: 278
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 297
  • Total: 297

timeformat

Started by jessicac, October 22, 2006, 06:01:12 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jessicac

Having problems finding the code for timeformat. Looking to change the timeformat in the shoutbox.

from Tportal.php
$shouts .='<div style="margin: 4px;"><div style="border: dotted 1px; padding: 2px 4px 2px 4px;" class="windowbg2"><b>'.$row['value3'].'</b></div><div style="padding: 2px;"> '.timeformat($row['value2']).'</div><div style="padding: 4px;">';

G6Cad

TPortalBlocks.template.php

look for the ShoutBox code in there

jacortina

Please note that every user can specify their own time format (it's in their Profile under Look and Layout preferences). Most, I believe, simply leave it as the forum default.

But this is the date/time format used throughout the forum (unless specifically bypassed for a specific use) and reflects default that is set via Admin.

The timeformat function itself is in Sources/Subs.php (but I DO caution you about changing that code as it IS used throughout the forum and reflects user-personalized preferences; to present the date/time in a different way for a certain use, I suggest you generate the presentation at that point of use unstead).

jessicac

Hmmm. Ok. good call on that I think. What would be the best way to format just the shoutbox? I looked through subs.php and I see the timeformat function but yeah, I don't want to mess with that or it would screw up everything else. Re-write to just pull timestamp and re-format for shoutbox only?

jacortina

Probably the easiest thing to do would be to format that time entry on the spot.

At the line in TPortal.php you already identified, change:
$shouts .='<div style="margin: 4px;"><div style="border: dotted 1px; padding: 2px 4px 2px 4px;" class="windowbg2"><b>'.$row['value3'].'</b></div><div style="padding: 2px;"> '.timeformat($row['value2']).'</div><div style="padding: 4px;">';

To:
$newtime = strftime("%D, %H:%M", ($row['value2'] + ($user_info['time_offset'] + $modSettings['time_offset']) * 3600))
$shouts .='<div style="margin: 4px;"><div style="border: dotted 1px; padding: 2px 4px 2px 4px;" class="windowbg2"><b>'.$row['value3'].'</b></div><div style="padding: 2px;"> '.$newtime.'</div><div style="padding: 4px;">';


You can find info on the formatting string for the strftime() function here: http://us3.php.net/strftime

And the line given will adjust for forum and user time offsets.

This website is proudly hosted on Crocweb Cloud Website Hosting.