Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted March 23, 20169 yr Yes, I know this has been asked before - I have searched... - and yet, I cannot get a satisfactory answer. Even this official IPS site displays date/time in the UK format of day month year which is puzzling as it is a USA site... I for the life of me cannot get the formatting to flip over to Month, Day, Year. This is supposed to be done automatically. Server locale is en_US.UTF-8 across the board. Server date is set to Chicago. IPS 4 has English USA as the only language pack. I got nothing in the ACP to work with. Is this something that is supposed to be in conf_global? Totally mystified (equally that the official IPS site is this way as well). This has *never* displayed in USA format for me since the days of the alpha even.
March 23, 20169 yr If your using a \IPS\DateTime object, then you can use the following method /** * Wrapper for format() so we can convert to UTF-8 if needed * * @param string $format Format accepted by date() * @return string */ public function format( $format ) { return \IPS\Member::loggedIn()->language()->convertString( parent::format( $format ) ); }
March 23, 20169 yr Author This is just in general - like, everywhere. I'm expecting March 23rd, 2016 and getting 23 March 2016 I've been looking at the method and @Mark a long ways back unofficially posted a plugin to override stuff (unsure if it still works...) but this is all supposed to be automatic right? That's why I'm asking as I'm not looking to override DateTime myself. My installs have all been local up to this point for dev/testing so I assumed it was just a WAMP thing but then again, viewing this site now it's all UK formatting of day-month-year. Browser, router, my location - I've looked at everything - all set to USA stuff. Those should be March 15th, etc... Right?
March 23, 20169 yr If you can find the post where he said what method to overload, I can make a plugin tonight.
March 23, 20169 yr Author You misunderstand. I can overload myself if I have to but this isn't supposed to be happening unless I'm way way off base. IPS is supposed to auto detect language/browser/server settings and display the date format for your region automatically. Either this is bugged, this is working as intended and everyone in the USA is supposed to see 12 March 2016 instead of March 12th, 2016, or *I* have something broke or mis-configured somewhere. I'm just trying to get a straight answer one way or the other...
April 20, 20168 yr Author And one hour later all is answered Quote First, thank you for your feedback! This is actually displaying as intended. However, IPS 4.1.12 is going to introduce the ability for you to customize these date formats to display however you like. So once 4.1.12 is released, you should be able to customize these if you would prefer for the dates to display as Jan 22 2015 instead of 22 Jan 2015 (as an example). Regards, Josh Hunter Invision Power Services, Inc.
Archived
This topic is now archived and is closed to further replies.