mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-10 03:04:05 +02:00
g_date_time_format: support %V
%V represents the ISO 8601 week number of the current year as a decimal number, range 01 to 53, where week 1 is the first week that has at least 4 days in the new year https://bugzilla.gnome.org/show_bug.cgi?id=658061
This commit is contained in:
committed by
Ryan Lortie
parent
0ea581b80a
commit
b42d15490b
@@ -2262,6 +2262,13 @@ get_numeric_format (gchar *fmt,
|
|||||||
* the day of the week as a decimal, range 1 to 7, Monday being 1
|
* the day of the week as a decimal, range 1 to 7, Monday being 1
|
||||||
* </simpara></listitem></varlistentry>
|
* </simpara></listitem></varlistentry>
|
||||||
* <varlistentry><term>
|
* <varlistentry><term>
|
||||||
|
* <literal>%%V</literal>:
|
||||||
|
* </term><listitem><simpara>
|
||||||
|
* the ISO 8601 week number of the current year as a decimal number,
|
||||||
|
* range 01 to 53, where week 1 is the first week that has at least
|
||||||
|
* 4 days in the new year. See g_date_time_get_week_of_year().
|
||||||
|
* </simpara></listitem></varlistentry>
|
||||||
|
* <varlistentry><term>
|
||||||
* <literal>%%W</literal>:
|
* <literal>%%W</literal>:
|
||||||
* </term><listitem><simpara>
|
* </term><listitem><simpara>
|
||||||
* the week number of the current year as a decimal number
|
* the week number of the current year as a decimal number
|
||||||
@@ -2509,6 +2516,10 @@ g_date_time_format (GDateTime *datetime,
|
|||||||
get_numeric_format (fmt, sizeof(fmt), alt_digits, 0, 0);
|
get_numeric_format (fmt, sizeof(fmt), alt_digits, 0, 0);
|
||||||
g_string_append_printf (outstr, fmt, g_date_time_get_day_of_week (datetime));
|
g_string_append_printf (outstr, fmt, g_date_time_get_day_of_week (datetime));
|
||||||
break;
|
break;
|
||||||
|
case 'V':
|
||||||
|
get_numeric_format (fmt, sizeof(fmt), alt_digits, '0', 2);
|
||||||
|
g_string_append_printf (outstr, fmt, g_date_time_get_week_of_year (datetime));
|
||||||
|
break;
|
||||||
case 'W':
|
case 'W':
|
||||||
get_numeric_format (fmt, sizeof(fmt), alt_digits, 0, 0);
|
get_numeric_format (fmt, sizeof(fmt), alt_digits, 0, 0);
|
||||||
g_string_append_printf (outstr, fmt, g_date_time_get_day_of_year (datetime) / 7);
|
g_string_append_printf (outstr, fmt, g_date_time_get_day_of_year (datetime) / 7);
|
||||||
|
Reference in New Issue
Block a user