Date format

Post

Posted
Rating:
#1364 (In Topic #291)
Avatar
Standard member
kitonline is in the usergroup ‘Fan in action’
I see in the language file "%e%k %B" "%e%k %B %Y" and with reference to the php manual, I really doubt why "%k" are there?
%k Two digit representation of the hour in 24-hour format, with a space preceding single digits 0 through 23
Online now: No Back to the top

Post

Posted
Rating:
#1367
Avatar
Site director
Chris Graham is in the usergroup ‘Administrators’
Hi,

Sorry for the confusion. We were using %k for something else different to what the PHP manual says. It's a special case.

This confused even me, so I'm changing it to %o.

(The PHP manual also confused me as there was an unrelated error in that too, so I've just reported a bug about that which they've confirmed.)

I've just pushed up a change to Transifex, which will be compatible with the next RC, which I expect out later today.

The new RC will be consistent with the following rules…

For dates and times we use the PHP http://php.net/manual/en/function.strftime.php function, except the following changes are made by Composr…
  • %e is the day of the month but will not have a leading space (because that's ugly) and will work on Windows servers too
  • %l is the 12-hour clock hour but will not have a leading space digit (because that's ugly)
  • %o is an English date ordinal (e.g. st or th)


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Follow me on Minds (where I am most active). Support me on Patreon

Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Online now: No Back to the top

Post

Posted
Rating:
#3215
Avatar
Standard member
Suchexperte is in the usergroup ‘Fan in action’
Hi Chris, how can I change an English date into a 24 hour display? And how and where can I (for example, st or th, change my rd to a simple point)? My page with the problem: Berlin-Best
Online now: No Back to the top

Post

Posted
Rating:
#3216
Avatar
Site director
Chris Graham is in the usergroup ‘Administrators’
Hi,

I'll re-phrase your questions for clarity:
  1. How do I change the displayed times from 12-hour clock to 24-hour clock?
  2. How do I change the locale to German?

1…

You change the following language strings in the global language file:
  • date_regular_time to %H:%M
  • date_verbose_time to %H:%M

2…

The operating system sets date prefixes, and many other things based on the locale, but the locale names vary between operating system so it can be a bit complex.

Try changing the locale language string of global to:
locale=de-DE.UTF-8,de_DE.UTF-8,de.UTF-8,de-DE,de_DE,de

More details on locale:
Composr Tutorial: Localisation and internationalisation - Composr
If you can't get proper locale working you can use the locale_subst language string to force in some substitutions.


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Follow me on Minds (where I am most active). Support me on Patreon

Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Online now: No Back to the top

Post

Posted
Rating:
#3220
Avatar
Site director
Chris Graham is in the usergroup ‘Administrators’
This is from the next docs update…

Dates

Commonly American users will want to use American-style short-form and long-form dates. That is, 2-14-2017 instead of 14-2-2017, and February 14th 2017 instead of 14th February 2017.

This is handled automatically via the "American English" configuration option, which remaps the default language string values for you.

However, it is useful for us to document the strings involved, and an illustrative example of date-string editing for non-English users, so…
String Purpose Most English-speaking countries American
date_concise_near_date
(global language file)
A date in concise long-form ~ within year %e %b (e.g. 14 Feb) %b %e (e.g. Feb 14)
date_no_year
(global language file)
A date in verbose long-form ~ within year %e%o %B %Y (e.g. 14th February) %B %e%o %Y (e.g. February 14th)
date_regular_date
(global language file)
A date in regular long-form %e%o %B %Y (e.g. 14th February 2017) %B %e%o %Y (e.g. February 14th 2017)
date_verbose_date
(global language file)
A date in verbose long-form %a %e%o %B %Y (e.g. Mon 14th February 2017) %a %B %e%o %Y (e.g. Mon February 14th 2017)
calendar_date
(calendar language file)
A date in short-form (calendar-only) %d-%m-%Y (e.g. 14-02-2017) %m-%d-%Y (e.g. 02-14-2017)
calendar_date_verbose
(calendar language file)
A date in verbose long-form (calendar-only) %a %e%o %B %Y (e.g. Mon 14th February 2017) %a %B %e%o %Y (e.g. Mon February 14th 2017)
calendar_day_of_month_verbose
(calendar language file)
A date within a month (calendar-only) %a %e%o (e.g. Mon 14th) %a %e%o (e.g. Mon 14th)


Non-English speaking users may want to make other changes, e.g. remove %o so that suffixes like th and st aren't used.

We define dates with some different variations. This is because practically it isn't appropriate to try and use only one format across the entire system. The calendar may use date formats from global, but the rest of Composr will not use date formats from the calendar.

Times

Commonly non-English users will want to switch to a 24-hour clock for time. Here's some guidance…
String Purpose Most English-speaking countries Most other countries
date_regular_time
(global language file)
A time in short form %l:%M %p (e.g. 8:14 am or 8:14 pm) %H:%M (e.g. 08:14 or 20:14)
date_verbose_time
(global language file)
A time in long form (calendar-only) %l:%M %p (e.g. 8:14 am or 8:14 pm) %H:%M (e.g. 08:14 or 20:14)
calendar_minute
(calendar language file)
A time (calendar-only) %l:%M %p (e.g. 8:14 am or 8:14 pm) %H:%M (e.g. 08:14 or 20:14)
calendar_date_range_single
(calendar language file)
A time range happening on a particular date ~ within month (calendar-only) %l:%M %p (%e%o) (e.g. 8:14 am (14th) or 8:14 pm (14th)) %l:%M %p (%e%o) (e.g. 8:14 am (14th) or 8:14 pm (14th))
calendar_date_range_single_long
(calendar language file)
A time range happening on a particular date (calendar-only) %l:%M %p (%e%o %b) (e.g. 8:14 am (14th Feb) or 8:14 pm (14th Feb)) %l:%M %p (%b %e%o) (e.g. 8:14 am (Feb 14th) or 8:14 pm (Feb 14th))


We define times with some different variations. This is because practically it isn't appropriate to try and use only one format across the entire system. The calendar may use time formats from global, but the rest of Composr will not use time formats from the calendar.

Last edit: by Chris Graham



Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Follow me on Minds (where I am most active). Support me on Patreon

Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Online now: No Back to the top
1 guest and 0 members have just viewed this.

Statistics

Users online:

Vaiva, Philip, Paul D, John Connor, MVLipwig, amit.nigam, mytracker, Detlef Ribbe (2), Manu

Forum statistics:
  • 1,062 topics, 5,122 posts, 5,962 members
  • Our newest member is esparkbiz
Birthdays:
Back to Top