Dateformat

General questions about CMSimple
lillebitte
Posts: 49
Joined: Fri Jan 29, 2016 7:20 am

Dateformat

Post by lillebitte » Sun Jan 07, 2018 3:45 pm

Isn't it possible to define how you want the timestamp to be formatted any longer?

cmb
Posts: 12931
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: Dateformat

Post by cmb » Sun Jan 07, 2018 4:21 pm

lillebitte wrote:Isn't it possible to define how you want the timestamp to be formatted any longer?
That is still possible as in older versions ($tx['lastupdate']['dateformat']), unless the Intl extension is available (check Settings → Info → PHP info), in which case you have to do it in the configuration (Settings → Configuration → Format → Date / Time).
Christoph M. Becker –Plugins for CMSimple_XH

lillebitte
Posts: 49
Joined: Fri Jan 29, 2016 7:20 am

Re: Dateformat

Post by lillebitte » Sun Jan 07, 2018 4:36 pm

No, Settings → Configuration → Format → Date / Time does not allow me to define how I want the format. First of all I do not want an English format, and I do not seem to even be able to get rid of that?
Edit:
I have tried to set Dateformat to "j. n Y, H:i" in Settings → Language → Lastupdate - Dateformat, and I get January 7, 2018 at 1:06 AM

cmb
Posts: 12931
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: Dateformat

Post by cmb » Sun Jan 07, 2018 5:38 pm

lillebitte wrote:No, Settings → Configuration → Format → Date / Time does not allow me to define how I want the format. First of all I do not want an English format, and I do not seem to even be able to get rid of that?
Edit:
I have tried to set Dateformat to "j. n Y, H:i" in Settings → Language → Lastupdate - Dateformat, and I get January 7, 2018 at 1:06 AM
Apparently, the Intl extension is available on your server. To get Danish dates, you have to change Settings → Language → Locale → All to "da_DK".

If you still don't like the format, you can change this line to:

Code: Select all

    if (false) {
Christoph M. Becker –Plugins for CMSimple_XH

lillebitte
Posts: 49
Joined: Fri Jan 29, 2016 7:20 am

Re: Dateformat

Post by lillebitte » Sun Jan 07, 2018 5:47 pm

That's better. Thank you very much!

lillebitte
Posts: 49
Joined: Fri Jan 29, 2016 7:20 am

Re: Dateformat

Post by lillebitte » Sun Jan 07, 2018 6:51 pm

I am afraid I still do not understand how to control the date format.
If I change the line 2567 in functions.php I am allowed to use the setting in Settings → Language → Lastupdate → Dateformat, but then I get English names for days and months, even with Settings → Language → Locale → All set to "da_DK".

cmb
Posts: 12931
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: Dateformat

Post by cmb » Sun Jan 07, 2018 7:46 pm

lillebitte wrote:I am afraid I still do not understand how to control the date format.
If I change the line 2567 in functions.php I am allowed to use the setting in Settings → Language → Lastupdate → Dateformat, but then I get English names for days and months, even with Settings → Language → Locale → All set to "da_DK".
You will not be able to get other day or month names than the English ones – that's a limitation of date() which is used in your case – and always in versions before CMSimple_XH 1.7.0.

Therefore the new mode based on the Intl extension has been introduced.
Christoph M. Becker –Plugins for CMSimple_XH

lillebitte
Posts: 49
Joined: Fri Jan 29, 2016 7:20 am

Re: Dateformat

Post by lillebitte » Sun Jan 07, 2018 8:49 pm

Hm, ok, thanks. At least I got rid of the English names, and that was good!

cmb
Posts: 12931
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: Dateformat

Post by cmb » Sun Jan 07, 2018 11:14 pm

lillebitte wrote:Hm, ok, thanks. At least I got rid of the English names, and that was good!
ACK. It would be possible to allow custom formats, but that looks rather complicated. Not sure, if it's worth the trouble. On the other hand, I'm somewhat confused that the short date format for da_DK is something like "06/01/2018", which appears to be rather uncommon.
Christoph M. Becker –Plugins for CMSimple_XH

lillebitte
Posts: 49
Joined: Fri Jan 29, 2016 7:20 am

Re: Dateformat

Post by lillebitte » Wed Jan 10, 2018 11:02 pm

Sorry, I have not been aware of your answer until now.
Actually I have used 1/1-18, but that's no big deal, and 01.01.2018 or 01-01-2018 is more common, especially now a days.
So now I'm just curious, what is Settings → Language → Lastupdate → Dateformat used for?

Post Reply