时间格式化

size_t strftime (char* ptr, size_t maxsize, const char* format,const struct tm* timeptr );

#include 

  time_t rawtime;
  struct tm * timeinfo;
  char buffer [80];

  time (&rawtime);
  timeinfo = localtime (&rawtime);

  strftime (buffer,80,"Now it's %I:%M%p.",timeinfo);

格式参考 http://www.cplusplus.com/reference/ctime/strftime/

你可能感兴趣的:(时间格式化)