custom formatting the current local date time into a string
Hello, How can I grab the current local date and time, and format it so that it looks like this: YYYY_MMM_DD_HH_MM_SS ? I can't seem to get the facet stuff to work right. Thanks, Jeff
Is this a boost question? If you want a boost solution take a look at boost::posix_time http://www.boost.org/doc/html/date_time/posix_time.html To get the local time, the following worked well for me so far. boost::posix_time::microsec_clock::local_time(); The following string conversion functions that comes with this library satisfy most of the general use cases. std::string to_simple_string(ptime) std::string to_iso_string(ptime) std::string to_iso_extended_string(ptime) Thanks, Edwin On 10/31/07, Jeff <grahamspam@earthlink.net> wrote:
Hello,
How can I grab the current local date and time, and format it so that it looks like this:
YYYY_MMM_DD_HH_MM_SS ?
I can't seem to get the facet stuff to work right.
Thanks, Jeff
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Edwin Savarimuthu
-
Jeff