1.日期格式转时间戳 function getTimestamp(time) { return Date.parse(new Date(time)); } 2.时间戳转日期格式 function transformPHPTime(time) { var date = new Date(time * 1000); Y = date.getFullYear() + '-'; M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.ge…
function datetime_to_unix(datetime){ var tmp_datetime = datetime.replace(/:/g,'-'); tmp_datetime = tmp_datetime.replace(/ /g,'-'); var arr = tmp_datetime.split("-"); var now = new Date(Date.UTC(arr[0],arr[1]-1,arr[2],arr[3]-8,arr…
<script> function js_strto_time(str_time){ var new_str = str_time.replace(/:/g,'-'); new_str = new_str.replace(/ /g,'-'); var arr = new_str.split("-"); var datum = new Date(Date.UTC(arr[0],arr[1]-1,arr[2],arr[3]-8,arr[4],arr[5])); return s…