#BAEL-16646 move java-dates "computations" articles under new Core Java module.

This commit is contained in:
Alessio Stalla
2019-09-30 15:52:48 +02:00
parent 491a912090
commit c70ac2cc73
21 changed files with 50 additions and 50 deletions

View File

@@ -4,3 +4,13 @@ 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)
- [Measure Elapsed Time in Java](http://www.baeldung.com/java-measure-elapsed-time)

View File

@@ -19,7 +19,18 @@
<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>

View File

@@ -1,28 +1,28 @@
package com.baeldung.datetime;
import java.util.Calendar;
import java.util.Date;
public class DateExtractYearMonthDayIntegerValues {
int getYear(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar.get(Calendar.YEAR);
}
int getMonth(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar.get(Calendar.MONTH);
}
int getDay(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar.get(Calendar.DAY_OF_MONTH);
}
}
package com.baeldung.datetime;
import java.util.Calendar;
import java.util.Date;
public class DateExtractYearMonthDayIntegerValues {
int getYear(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar.get(Calendar.YEAR);
}
int getMonth(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar.get(Calendar.MONTH);
}
int getDay(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar.get(Calendar.DAY_OF_MONTH);
}
}

View File

@@ -4,21 +4,11 @@
### 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)
- [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](http://www.baeldung.com/joda-time)
- [Comparing Dates in Java](https://www.baeldung.com/java-comparing-dates)

View File

@@ -15,23 +15,12 @@
</parent>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</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>

View File

@@ -469,7 +469,7 @@
<module>java-collections-maps</module>
<module>java-collections-maps-2</module>
<module>java-jdi</module>
<!--<module>core-java-modules/core-java-datetime</module>--> <!-- We haven't upgraded to java 9. Fixing in BAEL-10841 -->
<module>core-java-modules/core-java-datetime</module> <!-- We haven't upgraded to java 9. Fixing in BAEL-10841 -->
<!--<module>java-dates</module>-->
<!-- <module>java-ee-8-security-api</module> --> <!-- long running -->
<module>java-lite</module>