Hi,
I have been trying to format a simple posix date time for string representation.
The basic part is plain and simple:
----------------------------------------------
#include
namespace ps = boost::posix_time;
ps::ptime t(ps::second_clock::local_time());
std::string foo = ps::to_simple_string(t);
----------------------------------------------
But how can I format this returned string? I think the facets are required but as mentioned here : http://www.boost.org/doc/libs/1_40_0/doc/html/date_time/date_time_io.html#da...
I tried something with the boost::date_time::date_input_facet:
e.g
----------------------------------------------
ps::date_input_facet("%A");
ps::ptime t(ps::second_clock::local_time());
std::string foo = ps::to_simple_string(t);
----------------------------------------------
by using it before the simple_string call. I am sure this is wrong but I wouldn't like to use streams in addition to that to simply rearange some parts of a date for that reason.
thanks
sam
--
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser