Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
guFalcon committed May 21, 2021
2 parents c5306e8 + d27a1c4 commit 9dba803
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 28 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/target/

src/main/java/info/unterrainer/commons/jreutils/Information.java

.settings/
6 changes: 0 additions & 6 deletions .settings/org.eclipse.core.resources.prefs

This file was deleted.

8 changes: 0 additions & 8 deletions .settings/org.eclipse.jdt.core.prefs

This file was deleted.

4 changes: 0 additions & 4 deletions .settings/org.eclipse.m2e.core.prefs

This file was deleted.

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<modelVersion>4.0.0</modelVersion>
<artifactId>jre-utils</artifactId>
<version>0.1.9</version>
<version>0.1.10</version>
<name>JreUtils</name>
<packaging>jar</packaging>

Expand Down
12 changes: 10 additions & 2 deletions src/main/java/info/unterrainer/commons/jreutils/DateUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@UtilityClass
public class DateUtils {

public static DateTimeFormatter isoDateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
public static DateTimeFormatter ISO_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");

public static LocalDateTime nowUtc() {
return LocalDateTime.now(ZoneOffset.UTC);
Expand All @@ -31,6 +31,14 @@ public static int getWeekOf(final LocalDateTime dateTime) {
return dateTime.get(WeekFields.ISO.weekOfWeekBasedYear());
}

public static String localDateTimeToIso(final LocalDateTime localDateTime) {
return localDateTime.format(ISO_FORMATTER);
}

public static String zonedDateTimeToIso(final ZonedDateTime zonedDateTime) {
return zonedDateTime.format(ISO_FORMATTER);
}

/**
* Converts a UTC-issued LocalDateTime to a LocalDateTime issued by the
* time-zone specified by the timeZoneIdString.
Expand All @@ -46,7 +54,7 @@ public static LocalDateTime utcLocalDateTimeAtZone(final LocalDateTime utc, fina
}

public static String utcLocalDateTimeToLocalFormat(final LocalDateTime utc, final String timeZoneIdString) {
return utcLocalDateTimeToLocalFormat(utc, timeZoneIdString, isoDateTimeFormatter);
return utcLocalDateTimeToLocalFormat(utc, timeZoneIdString, ISO_FORMATTER);
}

public static String utcLocalDateTimeToLocalFormat(final LocalDateTime utc, final String timeZoneIdString,
Expand Down

This file was deleted.

0 comments on commit 9dba803

Please sign in to comment.