mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
@@ -39,6 +39,22 @@ export function timestampToDate(timestamp: number): string {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取当前时间, YY-MM-DD HH:MM:SS
|
||||
* @since Beta v0.3.6
|
||||
* @returns {string} 当前时间
|
||||
*/
|
||||
export function getNowStr(): string {
|
||||
const now = new Date();
|
||||
const year = now.getFullYear();
|
||||
const month = (now.getMonth() + 1).toString().padStart(2, "0");
|
||||
const date = now.getDate().toString().padStart(2, "0");
|
||||
const hour = now.getHours().toString().padStart(2, "0");
|
||||
const minute = now.getMinutes().toString().padStart(2, "0");
|
||||
const second = now.getSeconds().toString().padStart(2, "0");
|
||||
return `${year}-${month}-${date} ${hour}:${minute}:${second}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取设备信息(初始化时)
|
||||
* @since Beta v0.3.6
|
||||
|
||||
Reference in New Issue
Block a user