If you don't care about the API, you could use boost::date_time and it's time_facet.
Short example so far:
// setup facet and zone
// this facet should result like your desired format
std::string facet="%Y%m%d-%H:%M:%s";
std::string zone="UTC+00";
// create a facet
boost::local_time::local_time_facet *time_facet;
time_facet = new boost::local_time::local_time_facet;
// create a stream and imbue the facet
std::stringstream stream(std::stringstream::in | std::stringstream::out);
stream.imbue(std::locale(stream.getloc(), time_facet));
// create zone
boost::local_time::time_zone_ptr time_zone;
time_zone.reset(new boost::local_time::posix_time_zone(zone));
// write local from calculated zone in the given facet to stream
stream << boost::local_time::local_microsec_clock::local_time(time_zone);
// now you can get the string from stream
std::string my_time = stream.str();
This example is maybe incomplete, because I copied some code out of mine, but I hope you got the point.
With the facet, you can setup your format. The %s
(small s with, big S without fractial) setup seconds with fractial. You can read this in the documentation facet format.
The timezone is for calculating your local machine time to the right zone.