[glib] g_date_time_format: support %D
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] g_date_time_format: support %D
- Date: Sat, 3 Sep 2011 01:21:51 +0000 (UTC)
commit 46ce7907720074089040275280bb20208bafeb6a
Author: Ryan Lortie <desrt desrt ca>
Date: Fri Sep 2 19:38:45 2011 -0400
g_date_time_format: support %D
%D represents the date in mm/dd/yy format.
https://bugzilla.gnome.org/show_bug.cgi?id=658061
glib/gdatetime.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/glib/gdatetime.c b/glib/gdatetime.c
index 0b7665b..d3152d6 100644
--- a/glib/gdatetime.c
+++ b/glib/gdatetime.c
@@ -2166,6 +2166,10 @@ get_numeric_format (gchar *fmt,
* </term><listitem><simpara>
* the day of the month as a decimal number (range 01 to 31)
* </simpara></listitem></varlistentry>
+ * <literal>%%D</literal>:
+ * </term><listitem><simpara>
+ * equivalent to <literal>%%m/%%d/%%y</literal>
+ * </simpara></listitem></varlistentry>
* <varlistentry><term>
* <literal>%%e</literal>:
* </term><listitem><simpara>
@@ -2446,6 +2450,12 @@ g_date_time_format (GDateTime *datetime,
get_numeric_format (fmt, sizeof(fmt), alt_digits, pad_set ? pad : '0', 2);
g_string_append_printf (outstr, fmt, g_date_time_get_day_of_month (datetime));
break;
+ case 'D':
+ g_string_append_printf (outstr, "%02d/%02d/%02d",
+ g_date_time_get_month (datetime),
+ g_date_time_get_day_of_month (datetime),
+ g_date_time_get_year (datetime));
+ break;
case 'e':
get_numeric_format (fmt, sizeof(fmt), alt_digits, pad_set ? pad : ' ', 2);
g_string_append_printf (outstr, fmt, g_date_time_get_day_of_month (datetime));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]