Chinaunix首页 | 论坛 | 博客
  • 博客访问: 19282909
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类:

2008-04-18 09:16:02

$strtime = "2000-02-12 16:20:35";

$array = explode("-",$strtime);
$year = $array[0];
$month = $array[1];

$array = explode(":",$array[2]);
$minute = $array[1];
$second = $array[2];

$array = explode(" ",$array[0]);
$day = $array[0];
$hour = $array[1];

$timestamp = mktime($hour,$minute,$second,$month,$day,$year);

echo "字符串时间:$strtime
";
echo "年:$year
";
echo "月:$month
";
echo "日:$day
";
echo "时:$hour
";
echo "分:$minute
";
echo "秒:$second
";
echo "转换为timestamp:" . $timestamp . "
";
echo "从timestamp转换回来:" . date("y-m-d h:i:s",$timestamp) . "
";
?>

阅读(998) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~