SMF Community Helpers > SMF Documentation Help
SMF function 'timeformat': online doco doesn't match usage in 2.0.2
Shambles:
I was looking for a full description of parameter #2 of the timeformat() function, as what I was using in load.php for the "join date" mod needed a tweak.
So I went to the doco here, but it doesn't tally with how I see it being used in SMF 2.0.2 (parameter #2 now seems to be a 'format' image).
Can I assume that the formats used in php's date() function are now applicable to timeformat()?
emanuele:
Looking at the code I see:
--- Code: ---// Format a time to make it look purdy.
function timeformat($log_time, $show_today = true, $offset_type = false)
--- End code ---
So parameter 2 is still the boolean $show_today like it was in 1.1...am I missing anything?
Shambles:
This is from my load.php... code was added by the "join date" mod
--- Code: ---'joined' => empty($profile['date_registered']) ? '' : timeformat($profile['date_registered'], '%b %Y'),
--- End code ---
After looking around the doco and not seeing a resemblance, I tried changing it to
--- Code: ---'joined' => empty($profile['date_registered']) ? '' : timeformat($profile['date_registered'], '%d %b %Y'),
--- End code ---
.. which correctly added the day of the month.
That's why I questioned the doco.
Am I picking up a different/alien version of the timeformat function?
emanuele:
--- Code: ---$str = !is_bool($show_today) ? $show_today : $user_info['time_format'];
--- End code ---
The second parameter is used in a mixed way, if it is not a boolean value is assumed to be the format of the time...another Easter egg! :P
Shambles:
Ahaaa!
The thick plottens 8)
Good shout, calling it an "Easter Egg" - so no doco* needs updating then ;D
*(except my own)
Navigation
[0] Message Index
[#] Next page
Go to full version