免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2807 | 回复: 5

时间问题 [复制链接]

论坛徽章:
0
发表于 2003-04-24 12:09 |显示全部楼层
函数time()返回的是一个整数,在我知道了mon,day,year等一些值时,如何把他们转换成类似time()返回的这个整数?

论坛徽章:
1
荣誉会员
日期:2011-11-23 16:44:17
发表于 2003-04-24 12:56 |显示全部楼层

时间问题

1970年1月1日 使用 time()=1;
你可以換算回去.....

论坛徽章:
0
发表于 2003-04-24 18:15 |显示全部楼层

时间问题

不好算得,因为还有润年,比较麻烦,应该有一个函数吧?

论坛徽章:
0
发表于 2003-04-24 18:37 |显示全部楼层

时间问题

找到了一个函数,POSIX::mktime,但是不知道如何用?

论坛徽章:
1
荣誉会员
日期:2011-11-23 16:44:17
发表于 2003-04-24 21:25 |显示全部楼层

时间问题

mktime
Convert date/time info to a calendar time.
Synopsis:

mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)


The month (mon), weekday (wday), and yearday (yday) begin at zero. I.e. January is 0, not 1; Sunday is 0, not 1; January 1st is 0, not 1. The year (year) is given in years since 1900. I.e. The year 1995 is 95; the year 2001 is 101. Consult your system's mktime() manpage for details about these and the other arguments.

Calendar time for December 12, 1995, at 10:30 am.

        $time_t = POSIX::mktime( 0, 30, 10, 12, 11, 95 );
        print "Date = ", POSIX::ctime($time_t);


Returns undef on failure.

论坛徽章:
0
发表于 2003-04-26 01:35 |显示全部楼层

时间问题

那就用他了!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP