Conversion from Time to String is accomplished by means of several overloaded functions named make_string(). The simplest version of make_string() takes no parameters; it produces the default representation for the host machine location:
Time t = Time(1987,Time::july,3) + Duration::hours(13); cout << t.make_string() << endl;
There is also a version that takes a Place argument, which is needed when working with timezones other than the host machine location:
Time t = Time(1987,Time::july,3,Place::mountain()) + Duration::hours(13); cout << t.make_string(Place::mountain()) << endl;
which also prints
Two other versions (with and without Place parameters) take an additional argument which is similar to a printf(S) control string. The extra argument gives the client control over the representation. For example:
Time t = Time(1987,Time::july,3,Place::mountain()) + Duration::hours(13);
cout << t.make_string("%A %x at %r %Z", Place::mountain()) << endl;
Friday 07/03/87 at 01:00:00 PM MDT
Conversion from string (either const char* or String(C++)) to Time is accomplished using two versions of make_time(), one with and one without a Place parameter. These recognize a variety of date and time-of-day formats. For example, make_time("07/03/87 13:00:00",MDT) will return the value of t in the last example. make_string() uses a table of pointers to strings representing month names, weekday names, and so on. This table, which conforms to standard American usage, can be replaced at runtime by an alternate table conforming to local language and preferences. The functions Time::set_table() and Time::get_table() may be used for changing this table. Consult Time(C++) for a description of the table and how to change it.
If the string does not represent a valid Time, the Objection Time::string_objection is raised. What this means to the client is discussed in ``Error handling''.