Quote:
Originally Posted by Filip
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
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.