Boost logo

Boost :

From: Martin Adrian (adrianm_at_[hidden])
Date: 2006-02-28 02:51:31

Yuval Ronen <ronen_yuval <at>> writes:
> I think of specifying the format string as similar to specifying the
> printing precision of a float, or specifying that an integer should be
> printed as hex. These are provided as manipulators without the
> complexity of facets (which most users, including me, know very little
> about).

I don't agree with that comparison. Date formatting is more like the number
formatting (decimal separator, grouping etc) which is part of the locale for

Don't really see why you need manipulators. If you want to use the US date
format do setlocale("US"), if you want German dates do setlocale("DE") etc.
That is how you do it if you want numbers formatted and don't see why dates
are any different.

If you are writing an application that need to parse/print dates in a more
generic matter use a facet just as you do to handle different decimal

Unfortunatly the above doesn't work in the boost::date_time library since it
ignores the locale. A simple fix would be to let the default format be "%x"
and "%c" so you only need to mess with the facets if you want something that
isn't standard.

For some standard library implementations it is also possible to make the
setlocale work for parsing (e.g. libstd++ works fine while Dinkumware doesn't)

Boost list run by bdawes at, gregod at, cpdaniel at, john at