<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

 <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<title>无标题文档</title>

</head>

<body>

</body>

</html>

<script type="text/javascript">

function for_php_date_to_str(timestamp)

{

    update=new Date(timestamp*1000);//时间戳要乘1000

    year=update.getFullYear();

    month=(update.getMonth()+1<10)?('0'+(update.getMonth()+1)):(update.getMonth()+1);

    day=(update.getDate()<10)?('0'+update.getDate()):(update.getDate());

 

    hour=(update.getHours()<10)?('0'+update.getHours()):(update.getHours());

    minute=(update.getMinutes()<10)?('0'+update.getMinutes()):(update.getMinutes());

    second=(update.getSeconds()<10)?('0'+update.getSeconds()):(update.getSeconds());

 

    return (year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second);

}

alert(for_php_date_to_str("1381313200"))

</script>

相关文章:

  • 2021-10-13
  • 2022-12-23
  • 2022-12-23
  • 2022-01-20
  • 2022-12-23
  • 2022-12-23
  • 2022-02-20
  • 2023-03-24
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-08
  • 2021-12-22
  • 2021-09-18
相关资源
相似解决方案