Is it possible to change year in PHPBB?

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Post Reply
DaveTheBrave
Registered User
Posts: 3
Joined: Thu Mar 14, 2019 4:37 am

Is it possible to change year in PHPBB?

Post by DaveTheBrave » Thu Mar 14, 2019 4:47 am

Is it possible to change the year in the forum time? Say I wanted to change the year, for instance, instead of it being the current year "2019", it displays the year "1984"? I can't for the life of me figure out how to do this.

User avatar
david63
Jr. Extension Validator
Posts: 15588
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Is it possible to change year in PHPBB?

Post by david63 » Thu Mar 14, 2019 10:18 am

All things are possible - but not always practical.

Perhaps explaining what it is that you are trying to achieve would help but from what you have posted it would appear that you would need a core code change.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
EA117
Registered User
Posts: 322
Joined: Wed Aug 15, 2018 3:23 am
Contact:

Re: Is it possible to change year in PHPBB?

Post by EA117 » Thu Mar 14, 2019 11:21 am

DaveTheBrave wrote:
Thu Mar 14, 2019 4:47 am
...instead of it being the current year "2019", it displays the year "1984"?
If you're looking for a visual effect only, try going into your user control panel (UCP) and in the Board Preferences section select "Custom..." for the "Date format:" field. And then in the PHP date formatting tokens that are presented, change the "Y" (four-letter year) to literally "1984".

dateformat.png
dateformat.png (6.7 KiB) Viewed 288 times

In the PHP date formatting code, any characters which are not valid date placeholders "will be printed as-is". "1984" does not represent a valid PHP formatting character, and will be printed as-is everywhere the date format is used to display a date. So regardless of what year is in the actual date, it will display as 1984.

If you like that, there probably is a way to force that out as the default date format for all users. Setting it as the board's default date format should address getting new users to have this format.

Something more complicated, like "2019 should be shown as 1984, 2018 should be shown as 1983, 2017 should be shown as 1982, etc." and then "in 2020 it will be 2020 that is now shown as 1984, and 2019 becomes shown as 1983, and 2018 becomes shown as 1982, etc.", would probably need to be custom code added to datetime.php. To adjust the base date by a 1984-derived offset before allowing the date format code to then continue normally.

I do recommend that you don't try and run the actual web server with it's system date set to 1984. That would create the visual effect, but should open up a different set of problems. Manipulating "Date format:" keeps things "for display purposes only".

User avatar
Lumpy Burgertushie
Registered User
Posts: 65886
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Is it possible to change year in PHPBB?

Post by Lumpy Burgertushie » Thu Mar 14, 2019 4:49 pm

not sure but if you do that change it might affect the order of posts etc. I have seen cases where if the date is not correct it really screws up a board.


again, why do you want to do this.

robert
I am available for custom work on a donation basis. Please send me a PM with your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

OK, so what's the speed of dark?

DaveTheBrave
Registered User
Posts: 3
Joined: Thu Mar 14, 2019 4:37 am

Re: Is it possible to change year in PHPBB?

Post by DaveTheBrave » Fri Mar 15, 2019 4:38 am

I am only trying to get the visual effect, nothing too complicated.

I should mention that this is merely for a school project and I am not planning anything beyond the scope of my classroom.

User avatar
AmigoJack
Registered User
Posts: 5479
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Is it possible to change year in PHPBB?

Post by AmigoJack » Fri Mar 15, 2019 6:58 am

This can only be done by modifying existing PHP files and it will change every output of any time. There you could subtract 35 years. But internally many features rely on a correct time.
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.

User avatar
EA117
Registered User
Posts: 322
Joined: Wed Aug 15, 2018 3:23 am
Contact:

Re: Is it possible to change year in PHPBB?

Post by EA117 » Fri Mar 15, 2019 11:19 am

EA117 wrote:
Thu Mar 14, 2019 11:21 am
If you're looking for a visual effect only...
DaveTheBrave wrote:
Fri Mar 15, 2019 4:38 am
I am only trying to get the visual effect...
So does setting the "Date format:" to include a hard-coded "1984" string achieve what is needed, or does the school project require some more specific behavior in relation to how "1984" is involved?

User avatar
mrgoldy
Jr. Extension Validator
Posts: 891
Joined: Tue Oct 06, 2009 7:34 pm
Location: The Netherlands
Name: Gijs

Re: Is it possible to change year in PHPBB?

Post by mrgoldy » Sat Mar 16, 2019 11:28 am

I fail to see how adjusting the $user->format_date() function will break any functionality of the board? It will not alter any unix timestamps, which are the ones used for any functionality. The only other thing that has to be accounted for perhaps is the "Joined before" in the "Find a member" page.
Formerly known as posey.
''Proud member of the Studio"

DaveTheBrave
Registered User
Posts: 3
Joined: Thu Mar 14, 2019 4:37 am

Re: Is it possible to change year in PHPBB?

Post by DaveTheBrave » Sun Mar 17, 2019 4:40 am

EA117 wrote:
Fri Mar 15, 2019 11:19 am
EA117 wrote:
Thu Mar 14, 2019 11:21 am
If you're looking for a visual effect only...
DaveTheBrave wrote:
Fri Mar 15, 2019 4:38 am
I am only trying to get the visual effect...
So does setting the "Date format:" to include a hard-coded "1984" string achieve what is needed, or does the school project require some more specific behavior in relation to how "1984" is involved?
Yes, this will do. Thanks for the help

Post Reply

Return to “phpBB Custom Coding”

Who is online

Users browsing this forum: No registered users and 3 guests