Boards date format

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Get Involved
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
User avatar
Jaymie1989
Registered User
Posts: 1991
Joined: Thu Aug 02, 2007 5:21 pm
Name: Jaymie

Boards date format

Post by Jaymie1989 » Fri Feb 04, 2011 8:01 am

Hi,

I have a MOD installed that use's the boards date format that is set in the UCP and ACP. (This isnt a MOD question) This MOD shows the month and date on the topic pages. I am trying to shorten the time and date it shows.

Currently it shows like this
Local time: February 4th, 2011,
7:52 am
I want to have it all show on one line so I went into the UCP under Board preferences and changed 'My date format' to less than a minute ago / 04 Feb 2011, 07:57

My question is: How can I have the same date format on the whole board and for it to not be changed in the UCP.

Also my boards date format is 17 Jan 2011, 16:59 how can I add the am and pm after? I added the a after and there is no change.
Dear creators of Sesame Street,
Kids are still fat. Can I come back now?
Sincerely, Cookie Monster.

View my MODs - Need phpBB help with MODs and Styles? Take a look at my phpBB3 services

User avatar
tbackoff
Former Team Member
Posts: 7022
Joined: Thu Jun 04, 2009 1:41 am
Location: cheerleading practice
Name: Tabitha Backoff

Re: Boards date format

Post by tbackoff » Fri Feb 04, 2011 1:35 pm

Jaymie1989 wrote:My question is: How can I have the same date format on the whole board and for it to not be changed in the UCP.
You could try removing the option in the HTML file. In /styles/prosilver/template/ ucp_prefs_personal.html:

Code: Select all

	<dl>
		<dt><label for="dateformat">{L_BOARD_DATE_FORMAT}:</label><br /><span>{L_BOARD_DATE_FORMAT_EXPLAIN}</span></dt>
		<dd>
			<select name="dateoptions" id="dateoptions" onchange="if(this.value=='custom'){dE('custom_date',1);}else{dE('custom_date',-1);} if (this.value == 'custom') { document.getElementById('dateformat').value = default_dateformat; } else { document.getElementById('dateformat').value = this.value; }">
				{S_DATEFORMAT_OPTIONS}
			</select>
		</dd>
		<dd id="custom_date" style="display:none;"><input type="text" name="dateformat" id="dateformat" value="{DATE_FORMAT}" maxlength="30" class="inputbox narrow" style="margin-top: 3px;" /></dd>
	</dl>
Jaymie1989 wrote:I want to have it all show on one line so I went into the UCP under Board preferences and changed 'My date format' to less than a minute ago / 04 Feb 2011, 07:57
...
Also my boards date format is 17 Jan 2011, 16:59 how can I add the am and pm after? I added the a after and there is no change.
Have a read here. You could actually select "custom" and write your own date format. For exapmel, on my test board, I have mine set to this: Y-m-d, H:i:s and it outputs 2011-02-04, 08:34:57.
Flying is the second best thrill to cheerleaders; being caught is the first.

User avatar
Jaymie1989
Registered User
Posts: 1991
Joined: Thu Aug 02, 2007 5:21 pm
Name: Jaymie

Re: Boards date format

Post by Jaymie1989 » Fri Feb 04, 2011 1:48 pm

t_backoff wrote:
Jaymie1989 wrote:I want to have it all show on one line so I went into the UCP under Board preferences and changed 'My date format' to less than a minute ago / 04 Feb 2011, 07:57
...
Also my boards date format is 17 Jan 2011, 16:59 how can I add the am and pm after? I added the a after and there is no change.
Have a read here. You could actually select "custom" and write your own date format. For exapmel, on my test board, I have mine set to this: Y-m-d, H:i:s and it outputs 2011-02-04, 08:34:57.
Thanks for replying Tabitha.

I did try this custom one but it didnt work d M Y, H:i a I want to to show: 04 Feb 2011, 13:47 pm
Last edited by Jaymie1989 on Fri Feb 04, 2011 1:54 pm, edited 1 time in total.
Dear creators of Sesame Street,
Kids are still fat. Can I come back now?
Sincerely, Cookie Monster.

View my MODs - Need phpBB help with MODs and Styles? Take a look at my phpBB3 services

User avatar
tbackoff
Former Team Member
Posts: 7022
Joined: Thu Jun 04, 2009 1:41 am
Location: cheerleading practice
Name: Tabitha Backoff

Re: Boards date format

Post by tbackoff » Fri Feb 04, 2011 1:53 pm

I think am / pm is only available in the 12 hour format character(s). There's no need (in PHP's date format) to have am or pm, it's distinguished by the time in 24 hour format. 13:47 is 1:57 in the afternoon. Any particular reason you want to have am / pm added?

*EDIT* Looks like "a" is available. Let me test a few configurations.
Flying is the second best thrill to cheerleaders; being caught is the first.

User avatar
tbackoff
Former Team Member
Posts: 7022
Joined: Thu Jun 04, 2009 1:41 am
Location: cheerleading practice
Name: Tabitha Backoff

Re: Boards date format

Post by tbackoff » Fri Feb 04, 2011 1:59 pm

When using a custom date format, d M Y, H:i a works fine for me.
ucp.png
ucp.png (1.02 KiB) Viewed 753 times
last_post.png
last_post.png (2.86 KiB) Viewed 753 times
Flying is the second best thrill to cheerleaders; being caught is the first.

User avatar
Jaymie1989
Registered User
Posts: 1991
Joined: Thu Aug 02, 2007 5:21 pm
Name: Jaymie

Re: Boards date format

Post by Jaymie1989 » Fri Feb 04, 2011 2:09 pm

With the date format in the UCP set as standard with a new install of phpBB3.

On topics my local time look like this
Local time: Fri Feb 04, 2011 1:59
pm
I want it to show as
Local time: 04 Feb 2011, 1:59 pm
Which should be:
j M Y, G:i a

but in my topic page it still shows as
Local time: Fri Feb 04, 2011 1:59
pm
Its only when I change the date format in the UCP that the time changes on the board. :? This is what is confusing as I don't want to time to be changed in the UCP so the date format is how I want it.

Do you understand or am I making it confusing? :lol:
1.png
1.png (2.8 KiB) Viewed 752 times
2.png
2.png (3.41 KiB) Viewed 752 times
Dear creators of Sesame Street,
Kids are still fat. Can I come back now?
Sincerely, Cookie Monster.

View my MODs - Need phpBB help with MODs and Styles? Take a look at my phpBB3 services

User avatar
tbackoff
Former Team Member
Posts: 7022
Joined: Thu Jun 04, 2009 1:41 am
Location: cheerleading practice
Name: Tabitha Backoff

Re: Boards date format

Post by tbackoff » Fri Feb 04, 2011 2:13 pm

Change the j to d and the G to H. Also, have you read this part?
t_backoff wrote:
Jaymie1989 wrote:My question is: How can I have the same date format on the whole board and for it to not be changed in the UCP.
You could try removing the option in the HTML file. In /styles/prosilver/template/ ucp_prefs_personal.html:

Code: Select all

	<dl>
		<dt><label for="dateformat">{L_BOARD_DATE_FORMAT}:</label><br /><span>{L_BOARD_DATE_FORMAT_EXPLAIN}</span></dt>
		<dd>
			<select name="dateoptions" id="dateoptions" onchange="if(this.value=='custom'){dE('custom_date',1);}else{dE('custom_date',-1);} if (this.value == 'custom') { document.getElementById('dateformat').value = default_dateformat; } else { document.getElementById('dateformat').value = this.value; }">
				{S_DATEFORMAT_OPTIONS}
			</select>
		</dd>
		<dd id="custom_date" style="display:none;"><input type="text" name="dateformat" id="dateformat" value="{DATE_FORMAT}" maxlength="30" class="inputbox narrow" style="margin-top: 3px;" /></dd>
	</dl>
You will still have to change it for each user (possibly a SQL query if you have alot of members). Removing that code removes it from UCP, so they shouldn't be able to change it.
Flying is the second best thrill to cheerleaders; being caught is the first.

User avatar
Jaymie1989
Registered User
Posts: 1991
Joined: Thu Aug 02, 2007 5:21 pm
Name: Jaymie

Re: Boards date format

Post by Jaymie1989 » Fri Feb 04, 2011 2:23 pm

d M Y, H:i a That is what I have but it still shows it as

Mon Jan 17, 2011 4:59 pm on the index page and on my topic pages.

I am the only member on this one.
Dear creators of Sesame Street,
Kids are still fat. Can I come back now?
Sincerely, Cookie Monster.

View my MODs - Need phpBB help with MODs and Styles? Take a look at my phpBB3 services

User avatar
tbackoff
Former Team Member
Posts: 7022
Joined: Thu Jun 04, 2009 1:41 am
Location: cheerleading practice
Name: Tabitha Backoff

Re: Boards date format

Post by tbackoff » Fri Feb 04, 2011 2:26 pm

Have you changed it in your UCP? The screenshot you posted is the ACP. Once you change it via your UCP, you can then remove the code I provided.
Flying is the second best thrill to cheerleaders; being caught is the first.

User avatar
Jaymie1989
Registered User
Posts: 1991
Joined: Thu Aug 02, 2007 5:21 pm
Name: Jaymie

Re: Boards date format

Post by Jaymie1989 » Fri Feb 04, 2011 2:31 pm

In the UCP I changed it back to Fri Feb 04, 2011 2:30 pm which is what it is by default in phpBB3 and then removed the HTML from the ucp_prefs_personal.html

If I change it to what I want in the UCP, It wont be the same for all the other users will it and I want it to be changed for all the other users.
Dear creators of Sesame Street,
Kids are still fat. Can I come back now?
Sincerely, Cookie Monster.

View my MODs - Need phpBB help with MODs and Styles? Take a look at my phpBB3 services

User avatar
tbackoff
Former Team Member
Posts: 7022
Joined: Thu Jun 04, 2009 1:41 am
Location: cheerleading practice
Name: Tabitha Backoff

Re: Boards date format

Post by tbackoff » Fri Feb 04, 2011 2:35 pm

The ACP date settings are for users who register (they are given those settings). Since you are already registered, you have to change it in your UCP and then remove the code.
Flying is the second best thrill to cheerleaders; being caught is the first.

User avatar
Jaymie1989
Registered User
Posts: 1991
Joined: Thu Aug 02, 2007 5:21 pm
Name: Jaymie

Re: Boards date format

Post by Jaymie1989 » Fri Feb 04, 2011 2:36 pm

Oh, I see.

Ill register another user and try it.
Dear creators of Sesame Street,
Kids are still fat. Can I come back now?
Sincerely, Cookie Monster.

View my MODs - Need phpBB help with MODs and Styles? Take a look at my phpBB3 services

Pit$Bull
Former Team Member
Posts: 23099
Joined: Sat Dec 02, 2006 4:08 pm
Name: Can't Remember

Re: Boards date format

Post by Pit$Bull » Fri Feb 04, 2011 2:48 pm

The same principle applies to the format.

The normal settings for phpBB are as follows:

ACP (admin control panel) Time should be set at UTC as this is what guests and users not logged in will see.
UCP (user control panel) Time should be set to each individual users preference.


Use this to check your Server Time

User avatar
Jaymie1989
Registered User
Posts: 1991
Joined: Thu Aug 02, 2007 5:21 pm
Name: Jaymie

Re: Boards date format

Post by Jaymie1989 » Fri Feb 04, 2011 2:53 pm

Erm,

In the ACP the date format is set as
D d M, H:i a which shows Fri 04 Feb, 14:46 pm

but on a new user it shows
04 Feb 2011, 14:46 pm

Any ideas?

The UCP field has been removed as well so the user could not have changed it.

Result:(Apache Version/PHP Version)
Server Apache/Nginx/Varnish
Scripting Language
Server Time Fri, 04 Feb 2011 14:53:05 GMT
Dear creators of Sesame Street,
Kids are still fat. Can I come back now?
Sincerely, Cookie Monster.

View my MODs - Need phpBB help with MODs and Styles? Take a look at my phpBB3 services

User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 50667
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Boards date format

Post by stevemaury » Fri Feb 11, 2011 12:12 pm

The ACP setting has nothing to do with what a logged in user sees. By default, a users display is d M Y H:i, which is what you are seeing for the new user.

You could change the default for user_dateformat in the users table, which would affect all new users, and you can change the date format for existing usres. This query will do both:

Code: Select all

ALTER TABLE `phpbb_users` CHANGE `user_dateformat` `user_dateformat` VARCHAR( 30 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT 'D d M, H:i a';
UPDATE phpbb_users SET user_dateformat = 'D d M, H:i a';
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)

Locked

Return to “[3.0.x] Support Forum”