miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /  
 

Today/Yesterday instead of the date

 
 
Page  Page 2 of 2:  « Previous  1  2

Author Marius
Partaker
#16 | Posted: 10 Feb 2007 20:42 
The time after today/yesterday includes 'seconds', i.e. 15:30:11. How could you trim the seconds to show only hours and minutes, as well as set the time to AM or PM? Like so, 03:30 PM.

It also doesn't seem to take this setting into consideration:

$timeDiff=7200;

kind regards,
Marius

Author Paul
Lead Developer 
#17 | Posted: 11 Feb 2007 04:36 
For supressing the time output, you need just to cut off the $ttime variable from the final output. Like:

if($wp!='') $GLOBALS['lastPostDate']=$wp;

I have modified the code above, so it should consider $timeDiff now, but I've not tested it and not sure it works. Your thank is to report me this :-)

Unfortunatelly, I am always being weak at AM/PM and messing them up, so I'd better avoid providing a solution on how to convert this.

Author Marius
Partaker
#18 | Posted: 11 Feb 2007 05:04 
Hi Paul...the timediff is now taken into account. Thanks for that!

Unfortunately, suppressing $ttime variable gets rid off the hours and minutes as well, which I'd like to keep. Since regular miniBB timestamps show 'h:m' instead of 'h:m:s', it would be more consistent.

Don't worry if too much trouble, I just liked this idea, but wanted it to blend correctly with existing timestamps.

I thought it might have been as easy as an extra setting in setup like:

$dateFormat='m-j-Y h:i A';


I don't know how $ttime can be adjusted that way, or even if possible.

kind regards,
Marius

Author Paul
Lead Developer 
#19 | Posted: 11 Feb 2007 06:21 
I think you just need to take first 5 symbols of $ttime.

if($wp!='') $GLOBALS['lastPostDate']=$wp.' '.substr($ttime, 0, 5);

Author Marius
Partaker
#20 | Posted: 11 Feb 2007 06:31 
:thumbsup:

Thanks!

Author coco
Partaker
#21 | Posted: 28 Dec 2007 05:57 
bb_plugins.php:

/* displaying "Today/Yesterday" for available dates */
function parseTopic(){
........

when i put this code in bb_plugins php i get this message:

Fatal error: Cannot redeclare parsetopic() (previously declared in /home/xxx/public_html/forum/bb_plugins.php:87) in /home/xxx/public_html/forum/bb_plugins.php on line 193

Author tom322
Active Member
#22 | Posted: 28 Dec 2007 09:53 
You cannot declare parsetopic() function twice - you need to put the code somewhere right below line 87.

Author coco
Partaker
#23 | Posted: 28 Dec 2007 10:08 
thanks!
now is everything o.k. but the today's date is still displaying (28.12.) in the last post

Author tom322
Active Member
#24 | Posted: 28 Dec 2007 10:49 
When I used this addon I believe it worked OK...

Author coco
Partaker
#25 | Posted: 29 Dec 2007 04:26 
i used this addon as well and it worked o.k., but i installed a new minibb forum and now it doesn't work

Author Paul
Lead Developer 
#26 | Posted: 29 Dec 2007 11:33 
coco
What do you mean by i installed a new minibb forum? This function should absolutely work with any version of miniBB. Try to investigate your mistake or hire us to fix it.

Author R.U.R.
Guest
#27 | Posted: 20 Jul 2008 09:43 
I solved this like that:

In bb_functions.php, I added one line (the middle one):

$dateR=date($GLOBALS['dateFormat'],$dfval);
$dateR=str_replace(array( date($GLOBALS['dateOnlyFormat']) , date($GLOBALS['dateOnlyFormat'],time()-86400) ), array($GLOBALS['l_today'],$GLOBALS['l_yesterday']),$dateR);
$dateR=str_replace($engMon,$months,$dateR);
To setup_options.php I added:

$dateOnlyFormat='j.n.Y';
And to my language file I added:

$l_today='dnes';
$l_yesterday='včera';
I think this is a neat way how to solve the issue - any comments?

Author Paul
Lead Developer 
#28 | Posted: 20 Jul 2008 10:40 
R.U.R.
It's nice solution - as soon as you supply only day, month and a year in your date format. What if I supply hours, minutes?.. It won't work.

Author R.U.R.
Guest
#29 | Posted: 20 Jul 2008 15:08 
To quote myself:
R.U.R.:
To setup_options.php I added:
$dateOnlyFormat='j.n.Y';
which I use in the function.

It is true that the requirements are, that $dateOnlyFormat is a substring of $dateFormat and that it is a unique definition of date (containg day, month and year in any order and format).

The first requirement can be fulfilled easily by modifying setup_options.php somehow like that:

$dateOnlyFormat='j.n.Y'; //added line
$dateFormat="$dateOnlyFormat H:i"; //modified line
The second requirement would have to be stated explicitely, because eg. if the user set a format without the year part (like $dateOnlyFormat='j/n';)
it would lead to exactly-one-year-old posts (and exactly-two-years-old posts etc.) being marked as "today"...

Author Paul
Lead Developer 
#30 | Posted: 24 Jul 2008 03:37 
R.U.R.: I have re-checked everything above and I think your suggestion is very nice yet simple. Maybe it will be worth to include it in the next miniBB release as well (as an option). I'll think about it, thank you!

Page  Page 2 of 2:  « Previous  1  2 
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /
 Today/Yesterday instead of the date
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Install the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑