Internationalisation
dates et heures quelques exemples

Le système d'internationalisation du framework ICanBoogie offre des fonctionnalités de localisation et de formatage des dates et des heures.

Motifs de formattage de date

Un motif de date est une chaine de caractères, pour laquelle des chaînes de caractères spécifiques sont remplacées par des données de date et d'heure d'un calendrier lors du formattage ou utilisée pour générer des données pour un calendrier lors de l'analyse. Ces chaînes de caractères spécifiques sont décrites dans le document Unicode Locale Data Markup Language. Voici quelques exemples pour la date et l'heure actuelle :

Motif Résultat (fr)
yyyy.MM.dd G 'at' HH:mm:ss zzz 2017.11.20 ap. J.-C. at 07:25:06 GMT+0000
EEE, MMM d, ''yy lun., nov. 20, '17
h:mm a 7:25 AM
hh 'o''clock' a, zzzz 07 'oclock AM, GMT+0000
K:mm a, z 7:25 AM, GMT+0000
yyyyy.MMMM.dd GGG hh:mm aaa 02017.novembre.20 ap. J.-C. 07:25 AM

Table des symboles des motifs

Voici la liste des motifs définis par le consortium Unicode qui sont supportés par le système d'internationalisation du framework ICanBoogie :

Field Sym. No. Example (fr) Description
era G 1..3 ap. J.-C. Era - Replaced with the Era string for the current date. One to three letters for the abbreviated form, four letters for the long form, five for the narrow form.
4 après Jésus-Christ
5 ap. J.-C.
year y 1..n 2017 Year. Normally the length specifies the padding, but for two letters it also specifies the maximum length. Example:
y yy yyy yyyy yyyyy
2017 17 2017 2017 02017
Y 1..n Y Year (in "Week of Year" based calendars). This year designation is used in ISO year-week calendar as defined by ISO 8601, but can be used in non-Gregorian based calendar systems where week date processing is desired. May not always be the same value as calendar year.
u 1..n u Extended year. This is a single number designating the year of this calendar system, encompassing all supra-year fields. For example, for the Julian calendar system, year numbers are positive, with an era of BCE or CE. An extended year value for the Julian calendar system assigns positive values to CE years and negative values to BCE years, with 1 BCE being year 0.
quarter Q 1..2 04 Quarter - Use one or two for the numerical quarter, three for the abbreviation, or four for the full name.
3 T4
4 4e trimestre
q 1..2 04 Stand-Alone Quarter - Use one or two for the numerical quarter, three for the abbreviation, or four for the full name.
3 T4
4 4e trimestre
month M 1..2 11 Month - Use one or two for the numerical month, three for the abbreviation, four for the full name, or five for the narrow name.
3 nov.
4 novembre
5 N
L 1..2 11 Stand-Alone Month - Use one or two for the numerical month, three for the abbreviation, four for the full name, or 5 for the narrow name.
3 Nov.
4 Novembre
5 N
l 1 l Special symbol for Chinese leap month, used in combination with M. Only used with the Chinese calendar.
week w 1..2 47 Week of Year.
W 1 3 Week of Month.
day d 1..2 20 Day of the month.
D 1..3 324 Day of year.
F 1 3 Day of Week in Month. The example is for the 2nd Wed in July.
g 1..n g Modified Julian day. This is different from the conventional Julian day number in two regards. First, it demarcates days at local zone midnight, rather than noon GMT. Second, it is a local number; that is, it depends on the local time zone. It can be thought of as a single number that encompasses all the date-related fields..
week day E 1..3 lun. Day of week - Use one through three letters for the short day, or four for the full name, or five for the narrow name.
4 lundi
5 L
e 1..2 1 Local day of week. Same as E except adds a numeric value that will depend on the local starting day of the week, using one or two letters. For this example, Monday is the first day of the week.
3 lun.
4 lundi
5 L
c 1 1 Stand-Alone local day of week - Use one letter for the local numeric value (same as 'e'), three for the short day, or four for the full name, or five for the narrow name.
3 Lun.
4 Lundi
5 L
period a 1 AM AM or PM
hour h 1..2 7 Hour [0-12].
H 1..2 7 Hour [0-23].
K 1..2 7 Hour [0-11].
k 1..2 7 Hour [1-24].
j 1..2 n/a This is a special-purpose symbol. It must not occur in pattern or skeleton data. Instead, it is reserved for use in APIs doing flexible date pattern generation. In such a context, it requests the preferred format (12 versus 24 hour) for the language in question, as determined by whether h, H, K, or k is used in the standard short time format for the locale, and should be replaced by h, H, K, or k before beginning a match against availableFormats data.
minute m 1..2 25 Minute. Use one or two for zero padding.
second s 1..2 6 Second. Use one or two for zero padding.
S 1..n S Fractional Second - truncates (like other time fields) to the count of letters. (example shows display using pattern SSSS for seconds value 12.34567)
A 1..n A Milliseconds in day. This field behaves exactly like a composite of all time-related fields, not including the zone fields. As such, it also reflects discontinuities of those fields on DST transition days. On a day of DST onset, it will jump forward. On a day of DST cessation, it will jump backward. This reflects the fact that is must be combined with the offset field to obtain a unique local time value.

Motifs localisés prédéfinis

Natif Localisé (fr) Résultat
E E lun.
EHm E HH:mm lun. 07:25
EHms E HH:mm:ss lun. 07:25:06
Ed E d lun. 20
Ehm E h:mm a lun. 7:25 AM
Ehms E h:mm:ss a lun. 7:25:06 AM
Gy y G 2017 ap. J.-C.
GyMMM MMM y G nov. 2017 ap. J.-C.
GyMMMEd E d MMM y G lun. 20 nov. 2017 ap. J.-C.
GyMMMd d MMM y G 20 nov. 2017 ap. J.-C.
H HH 'h' 07 h
Hm HH:mm 07:25
Hms HH:mm:ss 07:25:06
M L 11
MEd E d/M lun. 20/11
MMM LLL Nov.
MMMEd E d MMM lun. 20 nov.
MMMd d MMM 20 nov.
Md d/M 20/11
d d 20
h h a 7 AM
hm h:mm a 7:25 AM
hms h:mm:ss a 7:25:06 AM
ms mm:ss 25:06
y y 2017
yM M/y 11/2017
yMEd E d/M/y lun. 20/11/2017
yMMM MMM y nov. 2017
yMMMEd E d MMM y lun. 20 nov. 2017
yMMMM MMMM y novembre 2017
yMMMd d MMM y 20 nov. 2017
yMd d/M/y 20/11/2017
yQQQ QQQ y T4 2017
yQQQQ QQQQ y 4e trimestre 2017