« [freeip] 清华大学校园网现行免费地址域列表20050928更新 | Main | SuSE Linux Professional 10.0 & SUSE 10.0 OSS (OpenSuSE) Released »
October 7, 2005
c shell perl php下的日期时间转换: 秒数与人类可读日期 scalar localtime 与 seconds since `00:00:00 1970-01-01 UTC'
|
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本声明。 http://windtear.net/archives/2005/10/07/000791.html http://windtear.net/archives/2005/10/07/000791.html scalar localtime 26-byte string 与 seconds since `00:00:00 1970-01-01 UTC' (1970年1月1日凌晨零点以来的秒数) the number of seconds that have passed since the Epoch: 00:00:00 January 1, 1970, Coordinated Universal Time (UTC). c: 《Advanced Programming in the UNIX Environment: Second Edition》 简称《APUE》 Seciont 6.10 Figure 6.8. Relationship of the various time functions 说的清楚 #include <time.h> time_t time(time_t *calptr); struct tm *localtime(const time_t *calptr); struct tm *gmtime(const time_t *calptr); time_t mktime(struct tm *tmptr); char *asctime(const struct tm *tmptr); char *ctime(const time_t *calptr); size_t strftime(char *restrict buf, size_t maxsize, const char *restrict format, const struct tm *restrict tmptr); shell: % date +%s 1128621784 % date -d "1970-01-01 UTC 1128621784 seconds" Fri Oct 7 02:03:04 CST 2005 perl: % perl -e 'print scalar localtime 1128621784' Fri Oct 7 02:03:04 2005 php: date('Y-m-d H:i:s',time()); |
Posted by windtear at October 7, 2005 2:04 AM
Trackback Pings
TrackBack URL for this entry:
http://cgi.windtear.net/cgi-bin/wt-tb.cgi/791
Comments
比较强!!
Posted by: snoopy at October 20, 2005 6:59 PM
Post a comment
【我爱网络】
2007-12-31 23:51 2007年度 ipcn.org/ipchina.org 总结报告
2007-12-31 00:31 vmware gsx server service
2007-12-31 00:15 squid 对 404 302 缓存的相关问题
2007-12-30 14:24 升级到 MovableType 3.3x 并修改 entry_basename 兼容性
2007-12-30 13:52 [php] realip judge 前面补0的ip格式剔除
2007-12-14 16:34 rm -rf * 系统管理员要排查的定时炸弹
2007-12-13 19:03 山西的宽带运营商太过分了 私自窜改dns解析
2007-12-13 16:35 F5 MIB 再学习 唯一性标记用地址的小bug
2007-12-11 22:15 perl 用Spreadsheet::WriteExcel写了个处理/读写excel的小程序
2007-12-11 13:39 perl 变量转义的问题