RWLocaleSnapshot and RWAnsiLocale
Classes RWLocaleSnapshot and RWAnsiLocale are two implementations of the interface defined by RWLocale. RWLocaleSnapshot extracts the information it needs from the global environment during construction with the help of such Standard C Library functions as strftime() and localeconv(). RWAnsiLocale wraps the C++ Standard Library std::locale, and can take advantage of the locales that are shipped with that implementation.
In discussion of the following examples, RWLocaleSnapshot and RWAnsiLocale are interchangeable.
The most straightforward way to use RWLocaleSnapshot is to pass it directly to the RWDateTime member function asString(), as follows. The first argument of the function asString() is a character, which may be any of the format options supported by the Standard C Library function strftime().
 
cout << today.asString('x', here) << endl;
There is, however, a more convenient way. You can install here as the global default locale so the insertion operator will use it:
 
RWLocale::global(&here);
cout << today << endl;
There are three ways to use an RWAnsiLocale object:
*By passing the object to functions that expect one, such as RWDateTime::asString().
*By using the object to specify a global locale using the static member function RWLocale::global(). This locale is then used as the default argument to functions that use a locale.
*By imbuing a stream with the object, so that when an RWDateTime is written to a stream using operator <<(), the appropriate formatting is used automatically.