Date format
Posted
#1402
(In Topic #338)
| %k | Two digit representation of the hour in 24-hour format, with a space preceding single digits | 0 through 23 |
Posted
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)
Posted
Code
Posted
I'll re-phrase your questions for clarity:
- How do I change the displayed times from 12-hour clock to 24-hour clock?
- 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:
If you can't get proper locale working you can use the locale_subst language string to force in some substitutions.
Posted
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
0 guests and 0 members have recently viewed this.