更新下 es6 版本標準時間戳 yyyy-mm-dd hh-mm-ss 2017-09-28 11:22:57
const
timeformat
=(date)
=>-$
-$$:
$:$`
}
然後直接在呼叫就可以了formatdatetime(date)
,傳入date物件,具體格式可以自行調整
幾分鐘前 幾小時前 幾天前 時間戳
function
formatdatetime
(date)
天前` }
else
if(dd<=
0&& hh>0)
小時前`
}else
if(hh<=
0&& mm>0)
分鐘前`
}else月$
日` }
}
然後直接在呼叫就可以了formatdatetime(date)
,傳入date物件,具體格式可以自行調整 類似 幾周前 幾個月前等等 時間戳轉換時間
遇到兩個問題,第一是當前時間轉化為時間戳,第二是獲取的當前時間和系統的時間相差8個小時 一,轉化的方法為 nsstring timesp nsstring stringwithformat d long localedate timeintervalsince1970 nslog timesp ti...
時間戳轉換日期 日期轉換時間戳 時間戳轉換星期
時間戳轉換日期 string date orderinfo.getchangetime replace null dateformat sdf new dateformat mm dd string monthdate sdf.format new date long.parselong date ...
時間戳轉換
echo gmdate f d,y time exit 英文格式 date y m d strtotime content publish time 時間格式不要時分秒 既然已經顯示為時間了,要去掉時分秒,可以使用date函式,date format,timestamp fortmat 必需 規定如...