一、将时间戳转成字符串


//strfmt


void metis_strftime(time_t t, char *pcTime)

{

  struct tm *tm_t;

  tm_t = localtime(&t);

  strftime(pcTime,128,"%F %T",tm_t);

}


二、将字符串转成时间戳


long metis_strptime(char *str_time){


  struct tm stm;  


  strptime(str_time, "%Y-%m-%d %H:%M:%S",&stm);

 

  long t = mktime(&stm);

  return t;


}