1.剩餘時間格式化
2.格式化時間戳/**
* 剩餘時間格式化
* * @export
* @param times //傳入毫秒
* @param [format='h:f:s'] // 大寫自動補全十位
* @returns string
*///小於10時,轉化為01,02等
export
function
formatnum
(n)`
: n;
}export
function
formatcountdown
(times, format =
'h:f:s')}
);}
3.獲取當前時間戳export
function
formatdate
(date, format =
'y年m月d日'
) date =
newdate
(date)
;break;}
default
:// do nothing...}if
(!(date instanceof
date))
return
;return format.
replace
(/y|y|m|m|d|d|h|h|f|f|s|s/g
,function
(a)});
}
4.獲取時間戳的周export
function
timestamp
(date)
else
}else
}
5.獲取當天0點時間export
function
getweek
(value, type =1)
return temparray[tempdate.
getday()
];}
6.獲取24點時間export
function
gettimesmorning
(date)
export
function
gettimesnight
(date)
array工具類,持續更新中,,,
1.陣列去重 function uniquearray arr return temp or return array.from new set arr 2.計算陣列中值的出現次數 const countoccurrences arr,value arr.reduce a,v v value a 1...
date 日期工具類
兩個日期相減獲得月份 param startcal param endcal return throws parseexception public static int twodatagetmonth string startcal,string endcal throws parseexcept...
時間date工具類
public class datetool public static date getnow public static string getdate public static string getym public static string getdatetime 獲得當前月的上一 publ...