diff options
Diffstat (limited to 'aai-els-onap-logging')
-rw-r--r-- | aai-els-onap-logging/src/main/java/org/onap/aai/util/FormatDate.java | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/util/FormatDate.java b/aai-els-onap-logging/src/main/java/org/onap/aai/util/FormatDate.java index 9ee2b71d..4243c539 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/util/FormatDate.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/util/FormatDate.java @@ -27,21 +27,18 @@ import java.time.format.DateTimeFormatter; public class FormatDate { private final String timeZone; - private final String pattern; + private final DateTimeFormatter formatter ; public FormatDate(String pattern) { - this.pattern = pattern; - this.timeZone = "GMT"; + this(pattern, "GMT"); } public FormatDate(String pattern, String timeZone) { - this.pattern = pattern; this.timeZone = timeZone; + this.formatter = DateTimeFormatter.ofPattern(pattern); } public String getDateTime() { - - final DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern); return formatter.format(ZonedDateTime.now(ZoneId.of(timeZone))); } } |