mirror of
https://github.com/SikongJueluo/cc-utils.git
synced 2025-11-05 11:47:48 +08:00
26 lines
490 B
TypeScript
26 lines
490 B
TypeScript
class ccDate {
|
|
private _timestamp: number;
|
|
|
|
constructor() {
|
|
this._timestamp = os.time(os.date("*t"));
|
|
}
|
|
|
|
public static toDateTable(timestamp: number): LuaDate {
|
|
return os.date("*t", timestamp) as LuaDate;
|
|
}
|
|
|
|
public toDateTable(): LuaDate {
|
|
return os.date("*t", this._timestamp) as LuaDate;
|
|
}
|
|
|
|
public static toTimestamp(date: LuaDate): number {
|
|
return os.time(date);
|
|
}
|
|
|
|
public toTimestamp(): number {
|
|
return this._timestamp;
|
|
}
|
|
}
|
|
|
|
export { ccDate };
|