Chinaunix首页 | 论坛 | 博客
  • 博客访问: 220048
  • 博文数量: 53
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1506
  • 用 户 组: 普通用户
  • 注册时间: 2013-07-25 10:52
文章分类
文章存档

2014年(22)

2013年(31)

我的朋友

分类: C/C++

2014-01-06 11:19:26

补充:Unix时间戳为11位的数字,从 Unix 新纪元(格林威治时间 1970 年 1 月 1 日 00:00:00)到当前时间的秒数,在数据库中常用int类型存储。


time

返回当前时间的Unix时间戳

格式:  int time ( void )


mktime

取得一个日期的 UNIX 时间戳

int mktime ( [int hour [, int minute [, int second [, int month [, int day [, int year [, int is_dst]]]]]]])



strtotime

将任何英文文本的日期时间描述解析为 UNIX 时间戳

int strtotime ( string time [, int now])

手册上的例子
1
2
3
4
5
6
7
8
9
    
echo strtotime ("now"), "\n";
echo strtotime ("10 September 2000"), "\n";
echo strtotime ("+1 day"), "\n";
echo strtotime ("+1 week"), "\n";
echo strtotime ("+1 week 2 days 4 hours 2 seconds"), "\n";
echo strtotime ("next Thursday"), "\n";
echo strtotime ("last Monday"), "\n";
?>
阅读(1185) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~