Changes between Version 4 and Version 5 of League/Calendar


Ignore:
Timestamp:
Nov 28, 2012, 12:10:47 PM (9 years ago)
Author:
vadim.godunko
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • League/Calendar

    v4 v5  
    1616 - League.Calendars.Gregorian - implements most useful mixed !Gregorian/Julian calendar. Date of switch from Julian to Gregorian calendars depends from locale. There is no year number zero. Not yet implemented.
    1717
    18 == Formatting ==
     18== Date Format Patterns ==
    1919
    20 Format template to convert date/time into the string can use following characters:
     20A date pattern is a string of characters, where specific strings of characters are replaced with date and time data from a calendar when formatting or used to generate data for a calendar when parsing.
    2121
    22 ||= Character =||= Number pf occurrences =||= Description =||
    23 || G || 1..3 || 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. ||
    24 ||   || 4  ||  ||
    25 ||   || 5  ||  ||
    26 || y || 1..n || Year. Normally the length specifies the padding, but for two letters it also specifies the maximum length. ||
    27 || Y || 1..n || 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. ||
    28 || u || 1..n || 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. ||
    29 || Q || 1..2 || Quarter - Use one or two for the numerical quarter, three for the abbreviation, or four for the full name. ||
    30 ||   || 3 || ||
    31 ||   || 4 || ||
    32 || q || 1..2 || Stand-Alone Quarter - Use one or two for the numerical quarter, three for the abbreviation, or four for the full name. ||
    33 ||   || 3 || ||
    34 ||   || 4 || ||
    35 || M || 1..2 || Month - Use one or two for the numerical month, three for the abbreviation, or four for the full name, or five for the narrow name. ||
    36 ||   || 3 || ||
    37 ||   || 4 || ||
    38 ||   || 5 || ||
    39 || L || 1..2 || Stand-Alone Month - Use one or two for the numerical month, three for the abbreviation, or four for the full name, or 5 for the narrow name. ||
    40 ||   || 3 || ||
    41 ||   || 4 || ||
    42 ||   || 5 || ||
    43 || l || 1 || Special symbol for Chinese leap month, used in combination with M. Only used with the Chinese calendar. ||
    44 || w || 1..2 || Week of Year. ||
    45 || W || 1 || Week of Month. ||
    46 || d || 1..2 || Date - Day of the month. ||
    47 || D || 1..3 || Day of year. ||
    48 || F || 1 || Day of Week in Month. ||
    49 || g || 1..n || 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. ||
    50 || E || 1..3 || Day of week - Use one through three letters for the short day, or four for the full name, or five for the narrow name. ||
    51 ||   || 4 || ||
    52 ||   || 5 || ||
    53 || e || 1..2 || 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. ||
    54 ||   || 3 || ||
    55 ||   || 4 || ||
    56 ||   || 5 || ||
    57 || c || 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. ||
    58 ||   || 3 || ||
    59 ||   || 4 || ||
    60 ||   || 5 || ||
    61 || a || 1 || AM or PM ||
    62 || h || 1..2 || Hour [1-12]. ||
    63 || H || 1..2 || Hour [0-23]. ||
    64 || K || 1..2 || Hour [0-11]. ||
    65 || k || 1..2 || Hour [1-24]. ||
    66 || j || 1..2 || 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. ^not supported^ ||
    67 || m || 1..2 || Minute. Use one or two for zero padding. ||
    68 || s || 1..2 || Second. Use one or two for zero padding. ||
    69 || S || 1..n || Fractional Second - truncates (like other time fields) to the count of letters. ||
    70 || A || 1..n || 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. ||
    71 || z || || ^not supported^ ||
    72 || Z || || ^not supported^ ||
    73 || v || || ^not supported^ ||
    74 || V || || ^not supported^ ||
    75 || ' || || ^not supported^ ||
     22Characters may be used multiple times. For example, if y is used for the year, 'yy' might produce '99', whereas 'yyyy' produces '1999'. For most numerical fields, the number of characters specifies the field width. For example, if h is the hour, 'h' might produce '5', but 'hh' produces '05'. For some characters, the count specifies whether an abbreviated or full form should be used, but may have other choices, as given below.
     23
     24Two single quotes represents a literal single quote, either inside or outside single quotes. Text within single quotes is not interpreted in any way (except for two adjacent single quotes). Otherwise all ASCII letter from a to z and A to Z are reserved as syntax characters, and require quoting if they are to represent literal characters. In addition, certain ASCII punctuation characters may become variable in the future (eg ":" being interpreted as the time separator and '/' as a date separator, and replaced by respective locale-sensitive characters in display).
     25
     26    Note: the counter-intuitive use of 5 letters for the narrow form of weekdays and months is forced by backwards compatibility.
     27
     28||= Field =||= Character =||= Number pf occurrences =||= Description =||
     29|| era || G || 1..3 || 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. ||
     30|| ||   || 4  ||  ||
     31|| ||   || 5  ||  ||
     32|| year || y || 1..n || Year. Normally the length specifies the padding, but for two letters it also specifies the maximum length. ||
     33|| || Y || 1..n || 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. ||
     34|| || u || 1..n || 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. ||
     35|| quarter || Q || 1..2 || Quarter - Use one or two for the numerical quarter, three for the abbreviation, or four for the full name. ||
     36|| ||   || 3 || ||
     37|| ||   || 4 || ||
     38|| || q || 1..2 || Stand-Alone Quarter - Use one or two for the numerical quarter, three for the abbreviation, or four for the full name. ||
     39|| ||   || 3 || ||
     40|| ||   || 4 || ||
     41|| month || M || 1..2 || Month - Use one or two for the numerical month, three for the abbreviation, or four for the full name, or five for the narrow name. ||
     42|| ||   || 3 || ||
     43|| ||   || 4 || ||
     44|| ||   || 5 || ||
     45|| || L || 1..2 || Stand-Alone Month - Use one or two for the numerical month, three for the abbreviation, or four for the full name, or 5 for the narrow name. ||
     46|| ||   || 3 || ||
     47|| ||   || 4 || ||
     48|| ||   || 5 || ||
     49|| || l || 1 || Special symbol for Chinese leap month, used in combination with M. Only used with the Chinese calendar. ||
     50|| week || w || 1..2 || Week of Year. ||
     51|| || W || 1 || Week of Month. ||
     52|| day || d || 1..2 || Date - Day of the month. ||
     53|| || D || 1..3 || Day of year. ||
     54|| || F || 1 || Day of Week in Month. ||
     55|| || g || 1..n || 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. ||
     56|| week day || E || 1..3 || Day of week - Use one through three letters for the short day, or four for the full name, or five for the narrow name. ||
     57|| ||   || 4 || ||
     58|| ||   || 5 || ||
     59|| || e || 1..2 || 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. ||
     60|| ||   || 3 || ||
     61|| ||   || 4 || ||
     62|| ||   || 5 || ||
     63|| || c || 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. ||
     64|| ||   || 3 || ||
     65|| ||   || 4 || ||
     66|| ||   || 5 || ||
     67|| period || a || 1 || AM or PM ||
     68|| hour || h || 1..2 || Hour [1-12]. ||
     69|| || H || 1..2 || Hour [0-23]. ||
     70|| || K || 1..2 || Hour [0-11]. ||
     71|| || k || 1..2 || Hour [1-24]. ||
     72|| minute || m || 1..2 || Minute. Use one or two for zero padding. ||
     73|| second || s || 1..2 || Second. Use one or two for zero padding. ||
     74|| || S || 1..n || Fractional Second - truncates (like other time fields) to the count of letters. ||
     75|| || A || 1..n || 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. ||
     76|| zone || z || || ^not supported^ ||
     77|| || Z || || ^not supported^ ||
     78|| || v || || ^not supported^ ||
     79|| || V || || ^not supported^ ||
     80|| special || ' || || ^not supported^ ||
     81|| || j || 1..2 || 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. ^not supported^ ||
     82
     83All non-letter character represent themselves in a pattern, except for the single quote. It is used to 'escape' letters. Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
    7684
    7785== Example ==