santaclaus 发表于 2018-10-7 06:14:55

javascript、php与mysql时间格式化函数

/*  @desc:时间友好显示函数
  @param stamp 时间缀,10位长度
  */
  function timefriend(stamp){
  this.stamp = stamp
  /*
  @desc:主方法,执行转换
  */
  this.get = function(){
  var stamp = this.stamp
  if(!stamp){
  return '—';
  }
  var date = new Date(stamp*1000)
  var time = Math.round(new Date().getTime()/1000)
  diff = time - stamp
  if(diff
页: [1]
查看完整版本: javascript、php与mysql时间格式化函数