diff options
author | Keuin <[email protected]> | 2020-08-02 18:31:50 +0800 |
---|---|---|
committer | keuin <[email protected]> | 2020-08-02 18:31:50 +0800 |
commit | d9c2af035ac2edb68bc8b6a1f94b7c772c3509c8 (patch) | |
tree | 4a27dd9a313090ae75d35e4d27d5bdd40b1eb218 /src/main/java/com/keuin/kbackupfabric/util/BackupNameTimeFormatter.java | |
parent | f09d420df609194a17e9d9ec63d710df8135aa8e (diff) |
Refactor & object tree impl. stage 1
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/util/BackupNameTimeFormatter.java')
-rw-r--r-- | src/main/java/com/keuin/kbackupfabric/util/BackupNameTimeFormatter.java | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/util/BackupNameTimeFormatter.java b/src/main/java/com/keuin/kbackupfabric/util/BackupNameTimeFormatter.java deleted file mode 100644 index 5d00270..0000000 --- a/src/main/java/com/keuin/kbackupfabric/util/BackupNameTimeFormatter.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.keuin.kbackupfabric.util; - -import java.time.LocalDateTime; -import java.time.ZoneId; -import java.time.ZoneOffset; -import java.time.format.DateTimeFormatter; - -public class BackupNameTimeFormatter { - private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd_HH-mm-ss"); - - public static String getTimeString() { - return LocalDateTime.now().format(formatter); - } - - public static long timeStringToEpochSeconds(String timeString) { - ZoneId systemZone = ZoneId.systemDefault(); // my timezone - LocalDateTime localDateTime = LocalDateTime.parse(timeString, formatter); - ZoneOffset currentOffsetForMyZone = systemZone.getRules().getOffset(localDateTime); - return localDateTime.toEpochSecond(currentOffsetForMyZone); - } - -} |