The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Newbie Question: How to Change Format of vb date?
Hi,
Ive downloaded and installed an add-on called "Last Seen Online" (https://vborg.vbsupport.ru/showthread.php?t=123366) which shows when users were last online in their postbit. It works as intended, and displays the following: Last Online: 26/09/2009 21.35PM I believe the relevent code is: Quote:
Unfortuately however, this is wider than the postbit on my forum and goes on to a second line which looks messy. So I was hoping to make it shorter. For example: Last Online: 26/09 21.35PM Or ideally in a more user friendly format; Last Online: Today 21.35PM My programming skills are a bit lacking but I had a go and tried making the following adjustment: Quote:
Not surprisingly this gave an error! So what is the correct markup to change the date format (btw I realise you can change the overall Date/Time options from the AdminCP, but I only wanted to change this)? Many Thanks. :up: |
#2
|
||||
|
||||
From the API:
Quote:
|
#3
|
|||
|
|||
Hi Lynne,
Thanks for the quick reply. Unfortunately to someone without much programming experience that is pretty difficult to follow! I tried various permutations of the following: Quote:
But sadly still get an error. Am I on the right lines? Thanks. |
#4
|
||||
|
||||
Basically, there are several variables that may be passed to that function. They are listed in the order they need to be passed. The values written in parenthesis are the default values if you don't pass anything. So, for instance, if you don't pass anything in the third slot (where it says " [boolean $doyestoday = false]"), then $doyestoday will be false. Since you want it to be true, you would pass the word "true" (no quotes) in the third slot (as in your exampe above):
PHP Code:
|
#5
|
|||
|
|||
Thanks for the reply. It now shows the following;
Last Online: 26/09 21.35PM Quote:
However, even though I believe I have the slot for $doyestoday set as true, its still not showing it in the format of; Last Online: Yesterday 21.35PM As I really wanted. What am I missing? Thanks. |
#6
|
||||
|
||||
What date format are you getting instead? Is it changing at all? Try putting d/m to something else and see if it works - it could be that the code can't translate that to today/yesterday.
|
#7
|
|||
|
|||
Hi Lynne,
Yeah it has changed. It was "Last Online: 26/09/2009 21.35PM" now its shorter without the year and fits in the postbit "Last Online: 26/09 21.35PM" which is good. Ideally I would have liked it in the format of Today/Yesterday as Ive seen on other forums, but maybe they had it set like that in the overall date/time options. Any ideas? |
#8
|
||||
|
||||
If you look at the code, this is the line that must eval to true in order for it to apply today/yesterday:
PHP Code:
|
#9
|
|||
|
|||
Ok I had to enable "Yesterday / Today" settings globally. The reason I didnt want to do this initially as obviously it changes the format of other dates on the forum.
So now, how can I change "Last Visit" column Members List back to the date format of d/m/y? Ive searched for "dateformat" in all the templates listed under Members List, but cant find anything. Where can I set this setting? Thanks. |
#10
|
||||
|
||||
Create a plugin using a hook location on that page that sets that option to what you want. Look at the top of the php page and see if a hook is at the start and use that one.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|