|
@@ -4,7 +4,35 @@ import crypto from "crypto";
|
|
|
export function numberB0(n) {
|
|
|
return n < 10 ? "0" + n : n;
|
|
|
}
|
|
|
+/**
|
|
|
+ *
|
|
|
+ * 传入时间戳,返回 hh-MM-ss
|
|
|
+ */
|
|
|
+export function getBztime(data = 1){
|
|
|
+ let myDate;
|
|
|
+
|
|
|
+ if(data !== 1){
|
|
|
+ myDate = new Date(data * 1000);
|
|
|
+ }else{
|
|
|
+ myDate = new Date();
|
|
|
+ }
|
|
|
+
|
|
|
+ let H = myDate.getHours(),
|
|
|
+ Min = myDate.getMinutes(),
|
|
|
+ S = myDate.getSeconds();
|
|
|
|
|
|
+
|
|
|
+ if(H < 10){
|
|
|
+ H = '0' + H ;
|
|
|
+ }
|
|
|
+ if(Min < 10){
|
|
|
+ Min = '0' + Min ;
|
|
|
+ }
|
|
|
+ if(S < 10){
|
|
|
+ S = '0' + S ;
|
|
|
+ }
|
|
|
+ return H + ':' + Min;
|
|
|
+}
|
|
|
/**
|
|
|
* 通过传入的时间戳获取所需的一个标准格式的日期
|
|
|
* 参数:
|
|
@@ -202,5 +230,6 @@ export default {
|
|
|
cascaderBugRepair,
|
|
|
getNewNum,
|
|
|
dateQjChange,
|
|
|
+ getBztime,
|
|
|
numberB0,
|
|
|
};
|