Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Design and Graphics Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 03-21-2009, 02:45 AM
zero5854 zero5854 is offline
 
Join Date: Oct 2008
Posts: 129
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default time format?

Ok so with help from staff I was able to change my forums last post time to say "X minutes ago"

So now I want to change this in a older mod I have. The code is like this....

Code:
$gnptime = vbdate('H:i', $gthread[lastpost]);
What would I change the 'H:i' to get it the same detailed time like X minutes ago?
Reply With Quote
  #2  
Old 03-21-2009, 04:02 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try something like:

PHP Code:
$gnptime vbdate($vbulletin->options['timeformat'], $gthread[lastpost], true); 
Reply With Quote
  #3  
Old 03-21-2009, 11:12 PM
zero5854 zero5854 is offline
 
Join Date: Oct 2008
Posts: 129
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

so I replace 'timeformat' with what???

BTW thanks for answering !
Reply With Quote
  #4  
Old 03-21-2009, 11:33 PM
TigerC10's Avatar
TigerC10 TigerC10 is offline
 
Join Date: Apr 2006
Location: Austin, TX
Posts: 616
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You don't replace it with anything. The variable being used $vbulletin->options['timeformat'] will be in your vBulletin date/time format options.

If you want to learn about the "H:i" modifier characters, view this page:
http://us2.php.net/manual/en/function.date.php



Have you tried
PHP Code:
$gnptime vbdate('i'$gthread[lastpost]); 


If you want to do it in a more complicated way it would be:
PHP Code:
$majormin date('H'$gthread[lastpost]) * 60;
$minormin date('i'$gthread[lastpost]);

$gnptime $majormin+$minormin
Reply With Quote
  #5  
Old 03-22-2009, 12:01 AM
zero5854 zero5854 is offline
 
Join Date: Oct 2008
Posts: 129
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks that was what I meant to ask sorry I wasnt more clear.

What im trying to achieve is X minutes ago
Reply With Quote
  #6  
Old 03-22-2009, 12:03 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by zero5854 View Post
so I replace 'timeformat' with what???

BTW thanks for answering !
I gave you a line to try in place of what you were trying.
Reply With Quote
  #7  
Old 03-22-2009, 12:12 AM
zero5854 zero5854 is offline
 
Join Date: Oct 2008
Posts: 129
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I know and I did thank you but that didnt do anything.... See I used 'H:i A' BUT It still shows army time. I tried the other guys code and it shows the wrong time.

heres mine.....
21-03, 21:08 PM

I want it to look like
21-3, 9:08 PM

Lastly I really wanted it to look say it was posted 1 minute ago...

21-3, 1 Minute ago

IS this possible?
Reply With Quote
  #8  
Old 03-22-2009, 02:11 AM
TigerC10's Avatar
TigerC10 TigerC10 is offline
 
Join Date: Apr 2006
Location: Austin, TX
Posts: 616
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's why I gave you the php manual page, it tells you how to make your own date format string. But since you're too lazy, here...

For "21-3, 9:08 PM" Use:

PHP Code:
$gnptime vbdate('j-n, g:i'$gthread[lastpost]); 
For the "1 Minute ago" thing, normally date's aren't shown - that's generally only if the post was made within an hour in the past. You'll have to do some math if you want that to display properly.

PHP Code:
//number of minutes between now and last post
$time_difference = (time() - $gthread[lastpost]) / 60;

if( 
$time_difference 60 )
{
    
$gnptime vbdate('j-n'$gthread[lastpost]);
    
$gnptime .= ', '$time_difference .' minutes ago';
}
else
{
    
$gnptime vbdate('j-n, g:i'$gthread[lastpost]);

Reply With Quote
  #9  
Old 03-22-2009, 03:07 AM
zero5854 zero5854 is offline
 
Join Date: Oct 2008
Posts: 129
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

sorry I am lazy I thought maybe someone knew off the top of their head as ive seen this on many forums. THanks for your hard work. Lately I have been lazy, working alot! thanks!

--------------- Added [DATE]1237755290[/DATE] at [TIME]1237755290[/TIME] ---------------

OK I see what u mean by the date thing so I guess I will remove that. Now I tried some of the code without the date thing but that only will show just a comma now? Any idea on that? I have tried the coding found at php website with no good results.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:31 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04628 seconds
  • Memory Usage 2,253KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (5)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete