php专区

 首页 > php专区 > PHP高级 > 日期 > php 时间数据转换为时间戳代码 - php日期

php 时间数据转换为时间戳代码 - php日期

分享到:
【字体:
导读:
          要做时间数据转换为时间戳我们利用php教程自带函数,strtotime() 函数将任何英文文本的日期时间描述解析为 Unix 时间戳 格式一 Fri Aug 05 12:19:04 +0800 2011strtotime(Fri Aug 05 1...

php 时间数据转换为时间戳代码

要做时间数据转换为时间戳我们利用php教程自带函数,strtotime() 函数将任何英文文本的日期时间描述解析为 Unix 时间戳.

格式一 Fri Aug 05 12:19:04 +0800 2011

strtotime("Fri Aug 05 12:19:04 +0800 2011");

格式二 2011-02-01

strtotime("2011-02-01");

其它参考:

  1. echo(strtotime("now")); 
  2. echo(strtotime("3 October 2005")); 
  3. echo(strtotime("+5 hours")); 
  4. echo(strtotime("+1 week")); 
  5. echo(strtotime("+1 week 3 days 7 hours 5 seconds")); 
  6. echo(strtotime("next Monday")); 
  7. echo(strtotime("last Sunday")); 
  8. ?> 
  9. /* 
  10. 输出: 
  11. 1138614504 
  12. 1128290400 
  13. 1138632504 
  14. 1139219304 
  15. 1139503709 
  16. 1139180400 
  17. 1138489200 
  18. */ 
分享到:
php 代码运行时间查看类 - php日期
php 代码运行时间查看类 class RunTime//页面执行时间类   {    private $starttime;//页面开始执行时间    private $stoptime;//页面结束执行时间    private $spendtime;//页面执行花费时间    function getmicrotime()//获取返回当前微秒数的浮点数   ...
php 中常用的日期处理函数 - php日期
php 中常用的日期处理函数 // date_format2($rs['time'],'%y年%m月%d日%h时%m分%s秒');  function date_format2($string, $format='%b %e, %y', $default_date=null)  {      if (substr(php教程_os,0,3) == 'win') {  ...
  •         php迷,一个php技术的分享社区,专属您自己的技术摘抄本、收藏夹。
  • 在这里……