求助:怎么将计算机时间转换成实际时间?
RT,就是任意给定过去某个计算机时间 例如 1218246780秒(1970.1.1 00:00:00为起点的秒数),如何转换成我们通用的年月日?先谢谢各位了!
程序代码:
#include <stdio.h>
#include <time.h>
void main( void )
{
struct tm *newtime;
char tmpbuf[128];
time_t lt1;
time( <1 );
newtime=localtime(<1);
strftime( tmpbuf, 128, "Today is %A, day %d of %B in the year %Y.\n", newtime);
printf(tmpbuf);
}


程序代码:
//任意给定过去某个计算机时间 例如 1218246780秒(1970.1.1 00:00:00为起点的秒数),如何转换成我们通用的年月日?
#include <stdio.h>
#include <time.h>
int main()
{
// struct tm *ptr;
time_t lt;
char tmpbuf[128];
struct tm *newtime;
lt =(time_t)1218246780;
newtime = localtime(<);
strftime( tmpbuf, 128, "Today is %A, day %d of %B in the year %Y.\n", newtime);
printf(tmpbuf);
return 0;
}


