你可以使用strptime
struct tm tm;
if (strptime("00:53:12", "%H:%M:%S", &tm) != NULL)
printf("hour: %d; minutes: %d; seconds: %d;\n",
tm.tm_hour, tm.tm_min, tm.tm_sec);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
213 次 |
| 最近记录: |