时间格式化

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

#include <time.h>

  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/

posted @ 2020-03-12 10:36  friedCoder  阅读(88)  评论(0编辑  收藏  举报