date format according to locale

Thomas Koester tkoester@intevation.de
Thu Mar 1 17:32:11 2001


Hi!

Entry fields promting for a date (expiry etc.) should offer a
default which shows the date format expected by gpa.
gpawidgets.c(gpa_expiry_frame_at) already contains code which tries
to do this with a fixed string, but can't work with all locale
settings.

Here is some example code for gpa_expiry_frame_at, which creates a
date 2 years in the future:

    newDate = g_date_new ();
    g_date_set_time (newDate, time (NULL));
    g_date_add_years (newDate, 2);
    dateBuffer = gpa_expiry_date_string (newDate);
    g_date_free (newDate);

where gpa_expiry_date_string calls
    g_date_strftime (date_buffer, 256, "%x", expiry_date)
to create a good date string. This should work even under Windows,
where the date format can be set in the control panel.

Thomas

-- 
Email: tkoester@intevation.de
http://intevation.de/~tkoester/