How to change the date presentation in viewtopic, viewforum

Discussion forum for MOD Writers regarding MOD Development.
Locked
volgograd
Registered User
Posts: 118
Joined: Tue Aug 19, 2014 1:34 pm
Name: Anna

How to change the date presentation in viewtopic, viewforum

Post by volgograd » Sun Nov 09, 2014 1:25 am

I have looked for the answer, and found information but I still don't understand what to do.

I want to change 'POSTER_JOINED' so it doesn't contain the time, and only has 3 letters of month.

In viewtopic.php I find

Code: Select all

'POSTER_JOINED'		=> $user_cache[$poster_id]['joined'],
Still don't understand about change the format with this.

string date ( string $format [, int $timestamp = time()]

Please can you help?

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51701
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: How to change the date presentation in viewtopic, viewforum

Post by Brf » Sun Nov 09, 2014 2:25 am

The date is formatted when it is moved into the user_cache. That is the line you want to change.

volgograd
Registered User
Posts: 118
Joined: Tue Aug 19, 2014 1:34 pm
Name: Anna

Re: How to change the date presentation in viewtopic, viewforum

Post by volgograd » Sun Nov 09, 2014 2:42 am

Thank you for responding. But I just don't understand how to format it. I don't find any reference. I look here http://php.net/manual/en/function.date.php but it give no examples or explain how to use paramaters. Maybe I'm stupid...

Viewtopic user information below avatar show the user join date. I want to format it, to show only the month and year. How do I?

User avatar
RaythXC
Registered User
Posts: 150
Joined: Wed Jun 13, 2012 1:23 pm

Re: How to change the date presentation in viewtopic, viewforum

Post by RaythXC » Sun Nov 09, 2014 4:10 pm

If you had read the page you linked fully you'll notice the table which tells you how to format. As such to get the format you need you'd use the following:

Code: Select all

date('M Y', $timestamp);
Replace $timestamp with whatever is needed when it creates the user cache, and if you only wish for the year to be 2 digits (example: 14 instead of 2014) change the Y to y (case does matter ;p)

Locked

Return to “[3.0.x] MOD Writers Discussion”