-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX #193] Fix logging of execution in rdf4j repo
- add DateUtils to handle conversion of different date classes to java.util.Date.
- Loading branch information
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
s-pipes-core/src/main/java/cz/cvut/spipes/util/DateUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package cz.cvut.spipes.util; | ||
|
||
import java.time.OffsetDateTime; | ||
import java.util.Date; | ||
import java.util.Objects; | ||
|
||
public class DateUtils { | ||
|
||
public static Date toDate(Object objectDate){ | ||
Objects.requireNonNull(objectDate); | ||
|
||
if(objectDate instanceof OffsetDateTime) | ||
return toDate((OffsetDateTime)objectDate); | ||
return (Date)objectDate; | ||
|
||
} | ||
|
||
public static Date toDate(OffsetDateTime objectDate) { | ||
Objects.requireNonNull(objectDate); | ||
return Date.from(objectDate.toInstant()); | ||
} | ||
} |