Merge pull request #8047 from alessiostalla/BAEL-16646-2

Bael 16646 2
This commit is contained in:
Josh Cummings
2019-10-26 14:25:57 -06:00
committed by GitHub
71 changed files with 601 additions and 463 deletions

View File

@@ -0,0 +1,15 @@
## Java Date/time computations Cookbooks and Examples
This module contains articles about date and time computations in Java.
### Relevant Articles:
- [Difference Between Two Dates in Java](http://www.baeldung.com/java-date-difference)
- [Get Date Without Time in Java](http://www.baeldung.com/java-date-without-time)
- [How to Get All Dates Between Two Dates?](http://www.baeldung.com/java-between-dates)
- [Extracting Year, Month and Day from Date in Java](http://www.baeldung.com/java-year-month-day)
- [Guide to java.util.GregorianCalendar](http://www.baeldung.com/java-gregorian-calendar)
- [Handling Daylight Savings Time in Java](http://www.baeldung.com/java-daylight-savings)
- [Calculate Age in Java](http://www.baeldung.com/java-get-age)
- [Increment Date in Java](http://www.baeldung.com/java-increment-date)
- [Add Hours To a Date In Java](http://www.baeldung.com/java-add-hours-date)
- [Introduction to Joda-Time](http://www.baeldung.com/joda-time)

View File

@@ -0,0 +1,71 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>core-java-datetime-computations</artifactId>
<version>${project.parent.version}</version>
<name>core-java-datetime-computations</name>
<packaging>jar</packaging>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-java</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../parent-java</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${joda-time.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.darwinsys</groupId>
<artifactId>hirondelle-date4j</artifactId>
<version>RELEASE</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>core-java-datetime-computations</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<joda-time.version>2.10</joda-time.version>
<!-- testing -->
<assertj.version>3.6.1</assertj.version>
<maven.compiler.source>1.9</maven.compiler.source>
<maven.compiler.target>1.9</maven.compiler.target>
</properties>
</project>

View File

@@ -0,0 +1,15 @@
## Java 8+ Date and Time API
This module contains articles about the Date and Time API introduced with Java 8.
### Relevant Articles:
- [Introduction to the Java 8 Date/Time API](http://www.baeldung.com/java-8-date-time-intro)
- [Migrating to the New Java 8 Date Time API](http://www.baeldung.com/migrating-to-java-8-date-time-api)
- [Get the Current Date, Time and Timestamp in Java 8](http://www.baeldung.com/current-date-time-and-timestamp-in-java-8)
- [TemporalAdjuster in Java](http://www.baeldung.com/java-temporal-adjuster)
- [ZoneOffset in Java](https://www.baeldung.com/java-zone-offset)
- [Differences Between ZonedDateTime and OffsetDateTime](https://www.baeldung.com/java-zoneddatetime-offsetdatetime)
- [Period and Duration in Java](http://www.baeldung.com/java-period-duration)
- [How to Get the Start and the End of a Day using Java](http://www.baeldung.com/java-day-start-end)
- [Set the Time Zone of a Date in Java](https://www.baeldung.com/java-set-date-time-zone)
- [Comparing Dates in Java](https://www.baeldung.com/java-comparing-dates)

View File

@@ -1,17 +1,16 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.baeldung</groupId>
<artifactId>java-dates</artifactId>
<version>0.1.0-SNAPSHOT</version>
<name>java-dates</name>
<artifactId>core-java-datetime-java8</artifactId>
<version>${project.parent.version}</version>
<name>core-java-datetime-java8</name>
<packaging>jar</packaging>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-java</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-java</relativePath>
<relativePath>../../parent-java</relativePath>
</parent>
<dependencies>
@@ -21,11 +20,10 @@
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${joda-time.version}</version>
</dependency>
<!-- test scoped -->
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
@@ -33,20 +31,15 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${joda-time.version}</version>
</dependency>
<dependency>
<groupId>com.darwinsys</groupId>
<artifactId>hirondelle-date4j</artifactId>
<version>RELEASE</version>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>java-dates</finalName>
<finalName>core-java-datetime-java8</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
@@ -68,10 +61,10 @@
</build>
<properties>
<maven.compiler.source>1.9</maven.compiler.source>
<maven.compiler.target>1.9</maven.compiler.target>
<joda-time.version>2.10</joda-time.version>
<!-- testing -->
<assertj.version>3.6.1</assertj.version>
<maven.compiler.source>1.9</maven.compiler.source>
<maven.compiler.target>1.9</maven.compiler.target>
</properties>
</project>

View File

@@ -0,0 +1,8 @@
## Java Time Measurements
This module contains articles about the measurement of time in Java.
### Relevant Articles:
- [Guide to the Java Clock Class](http://www.baeldung.com/java-clock)
- [Measure Elapsed Time in Java](http://www.baeldung.com/java-measure-elapsed-time)
- [Overriding System Time for Testing in Java](https://www.baeldung.com/java-override-system-time)

View File

@@ -0,0 +1,102 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.baeldung.exception.numberformat</groupId>
<artifactId>core-java-time-measurements</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>core-java-time-measurements</name>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-java</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../parent-java</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<!-- test scoped -->
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${joda.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${asspectj.version}</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit</artifactId>
<version>${jmockit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>core-java-time-measurements</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<argLine>
-javaagent:${settings.localRepository}/org/jmockit/jmockit/${jmockit.version}/jmockit-${jmockit.version}.jar
</argLine>
<disableXmlReport>true</disableXmlReport>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<!-- util -->
<commons-math3.version>3.6.1</commons-math3.version>
<joda.version>2.10</joda.version>
<!-- testing -->
<assertj.version>3.6.1</assertj.version>
<asspectj.version>1.8.9</asspectj.version>
<powermock.version>2.0.0-RC.4</powermock.version>
<jmockit.version>1.44</jmockit.version>
<!-- plugins -->
<maven-surefire-plugin.version>2.22.1</maven-surefire-plugin.version>
</properties>
</project>

View File

@@ -21,7 +21,6 @@
- [ASCII Art in Java](http://www.baeldung.com/ascii-art-in-java)
- [What is the serialVersionUID?](http://www.baeldung.com/java-serial-version-uid)
- [A Guide to the ResourceBundle](http://www.baeldung.com/java-resourcebundle)
- [Guide to the Java Clock Class](http://www.baeldung.com/java-clock)
- [Importance of Main Manifest Attribute in a Self-Executing JAR](http://www.baeldung.com/java-jar-executable-manifest-main-class)
- [Java Global Exception Handler](http://www.baeldung.com/java-global-exception-handler)
- [How to Get the Size of an Object in Java](http://www.baeldung.com/java-size-of-object)

26
java-dates/.gitignore vendored
View File

@@ -1,26 +0,0 @@
*.class
0.*
#folders#
/target
/neoDb*
/data
/src/main/webapp/WEB-INF/classes
*/META-INF/*
.resourceCache
# Packaged files #
*.jar
*.war
*.ear
# Files generated by integration tests
*.txt
backup-pom.xml
/bin/
/temp
#IntelliJ specific
.idea/
*.iml

View File

@@ -1,24 +0,0 @@
=========
## Java Dates Cookbooks and Examples
### Relevant Articles:
- [TemporalAdjuster in Java](http://www.baeldung.com/java-temporal-adjuster)
- [Handling Daylight Savings Time in Java](http://www.baeldung.com/java-daylight-savings)
- [Period and Duration in Java](http://www.baeldung.com/java-period-duration)
- [Difference Between Two Dates in Java](http://www.baeldung.com/java-date-difference)
- [Migrating to the New Java 8 Date Time API](http://www.baeldung.com/migrating-to-java-8-date-time-api)
- [Introduction to the Java 8 Date/Time API](http://www.baeldung.com/java-8-date-time-intro)
- [Get the Current Date, Time and Timestamp in Java 8](http://www.baeldung.com/current-date-time-and-timestamp-in-java-8)
- [Get Date Without Time in Java](http://www.baeldung.com/java-date-without-time)
- [How to Get All Dates Between Two Dates?](http://www.baeldung.com/java-between-dates)
- [Extracting Year, Month and Day from Date in Java](http://www.baeldung.com/java-year-month-day)
- [Guide to java.util.GregorianCalendar](http://www.baeldung.com/java-gregorian-calendar)
- [Measure Elapsed Time in Java](http://www.baeldung.com/java-measure-elapsed-time)
- [How to Get the Start and the End of a Day using Java](http://www.baeldung.com/java-day-start-end)
- [Calculate Age in Java](http://www.baeldung.com/java-get-age)
- [Increment Date in Java](http://www.baeldung.com/java-increment-date)
- [Add Hours To a Date In Java](http://www.baeldung.com/java-add-hours-date)
- [ZoneOffset in Java](https://www.baeldung.com/java-zone-offset)
- [Differences Between ZonedDateTime and OffsetDateTime](https://www.baeldung.com/java-zoneddatetime-offsetdatetime)
- [Introduction to Joda-Time](https://www.baeldung.com/joda-time)

View File

@@ -1 +0,0 @@
### Relevant Articles:

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@@ -1,13 +0,0 @@
*.class
#folders#
/target
/neoDb*
/data
/src/main/webapp/WEB-INF/classes
*/META-INF/*
# Packaged files #
*.jar
*.war
*.ear

20
pom.xml
View File

@@ -393,8 +393,14 @@
<module>core-java-modules/core-java-streams</module>
<module>core-java-modules/core-java-function</module>
<module>core-java-modules/core-java-lang-math</module>
<!--<module>core-java-modules/core-java-datetime-conversion</module>--> <!-- We haven't upgraded to java 9.-->
<!--<module>core-java-modules/core-java-datetime-string</module>--> <!-- We haven't upgraded to java 9.-->
<!-- We haven't upgraded to java 9.-->
<!--
<module>core-java-modules/core-java-datetime-computations</module>
<module>core-java-modules/core-java-datetime-conversion</module>
<module>core-java-modules/core-java-datetime-java8</module>
<module>core-java-modules/core-java-datetime-string</module>
<module>core-java-modules/core-java-time-measurements</module>
-->
<module>core-java-modules/core-java-text</module>
<module>core-java-modules/core-java-lambdas</module>
<!--<module>core-java-modules/core-java-9</module> --> <!-- We haven't upgraded to java 9. Fixing in BAEL-10841 -->
@@ -1157,8 +1163,14 @@
<module>core-java-modules/core-java-streams</module>
<module>core-java-modules/core-java-function</module>
<module>core-java-modules/core-java-lang-math</module>
<!--<module>core-java-modules/core-java-datetime-conversion</module>--> <!-- We haven't upgraded to java 9.-->
<!--<module>core-java-modules/core-java-datetime-string</module>--> <!-- We haven't upgraded to java 9.-->
<!-- We haven't upgraded to java 9.-->
<!--
<module>core-java-modules/core-java-datetime-computations</module>
<module>core-java-modules/core-java-datetime-conversion</module>
<module>core-java-modules/core-java-datetime-java8</module>
<module>core-java-modules/core-java-datetime-string</module>
<module>core-java-modules/core-java-time-measurements</module>
-->
<module>core-java-modules/core-java-text</module>
<!--<module>core-java-modules/core-java-9</module> --> <!-- We haven't upgraded to java 9. Fixing in BAEL-10841 -->
<!--<module>core-java-modules/core-java-os</module> --> <!-- We haven't upgraded to java 9.-->