Thread: vBulletin Forum Sideblocks - UpComing Events SideBlock/Bar With/Without Image
View Single Post
  #116  
Old 02-06-2013, 06:36 PM
CptBogo CptBogo is offline
 
Join Date: May 2007
Location: ATL
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Filip View Post
Is there a simple way to have the date being displayed in a other language than english?
if the user logged into vbulletin has another language set in their profile the vbdate function should adjust it for their language. you might want to change the format the date is displayed in though vbdate("format here", time())
if you are familiar with PHP you might want to have a look at these functions:
http://www.php.net/manual/en/function.setlocale.php
http://www.php.net/manual/en/function.strftime.php
they work together, you use the first function to set the language you want to use and the second function creates the date string based on the language you defined in the first function. note that the vbdate function includes those 2 functions in it.


Quote:
Originally Posted by rhody401 View Post
I like the changes you made a couple posts before this one(VBDATE), but it still seems to show one day earlier than the scheduled date. (for all events on my calendar)

I have the cache set to 0, etc.

Any ideas why? Are you having the same issue?
i did not have this issue. however it looks like others have been experiencing it. there are a couple solutions in this thread. but the easiest is probably:
PHP Code:
$format sprintf("On %s at %s"vbdate('jS M, Y',$event['dateline_from']+86400), vbdate('g:i A'$event['dateline_from'])); 
this simply adds 1 day(in seconds) to the events timestamp so when it gets the formatted date string its +1 day


also for those interested i have updated my own code to show 'Today', 'Tomorrow', etc instead of the day, month and year. if the date is more then a week in the future it will display the full day, month, year format(February 6th, 2013).

PHP Code:
if(vbdate("dmY"$event['dateline_from']) == vbdate("dmY")) //it is today.
    
{
        
$format sprintf("Today at %s"vbdate('g:i A'$event['dateline_from']));
    }
    elseif(
vbdate("dmY"$event['dateline_from']) == vbdate("dmY"time() + 86400)) //it is tomorrow
    
{
        
$format sprintf("Tomorrow at %s"vbdate('g:i A'$event['dateline_from']));
    }
    elseif(
$event['dateline_from'] < (time() + 604800)) //1 week = 604800 //it is this week
    
{
        
$format sprintf("%s at %s"vbdate('l',$event['dateline_from']), vbdate('g:i A'$event['dateline_from']));
    }
    else
    {
        
$format sprintf("%s at %s"vbdate('l, F jS',$event['dateline_from']), vbdate('g:i A'$event['dateline_from']));
    } 




Edit: I have discovered an issue where full day events that do not have a start time specified dont display correctly. for example the last event in my screenshot, "Starcraft II Risk", should start at 12AM on Saturday and not on Friday. i do not currently have a way to fix this but when i do i will post an update.
Reply With Quote
Благодарность от:
ProFifaLeagues
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01484 seconds
  • Memory Usage 1,800KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_box_bit
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete