且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

用C语言从1970年1月1日转换秒日期

更新时间:2022-11-13 13:05:29

标准C函数转换秒时代以来到分解的时候,是本地时间() gmtime的(),根据您的需要。然后,您可以使用 asctime()来分解时间转换为字符串。不要忘了的#include< time.h中方式> 并读取相应的手册页

The Standard C function to convert seconds since the epoch to a broken down time, is localtime() or gmtime(), depending on your needs. You might then use asctime() to convert broken down times to a string. Don't forget to #include <time.h> and read the corresponding manual pages.