aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/helper
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-13 10:34:02 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-13 10:34:02 +1300
commite997c2642b35350241614acaef6d606e37223fe6 (patch)
tree145cd9817c3b8d4954200ada5012b91719697f8f /src/org/traccar/helper
parent797263bfe9655ac82a97954c6930ec4a650a0609 (diff)
downloadtrackermap-server-e997c2642b35350241614acaef6d606e37223fe6.tar.gz
trackermap-server-e997c2642b35350241614acaef6d606e37223fe6.tar.bz2
trackermap-server-e997c2642b35350241614acaef6d606e37223fe6.zip
Extend date builder interface
Diffstat (limited to 'src/org/traccar/helper')
-rw-r--r--src/org/traccar/helper/DateBuilder.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/org/traccar/helper/DateBuilder.java b/src/org/traccar/helper/DateBuilder.java
index e0e9e0cab..17936a329 100644
--- a/src/org/traccar/helper/DateBuilder.java
+++ b/src/org/traccar/helper/DateBuilder.java
@@ -55,6 +55,18 @@ public class DateBuilder {
return setYear(year).setMonth(month).setDay(day);
}
+ public DateBuilder setDateReverse(int day, int month, int year) {
+ return setDate(year, month, day);
+ }
+
+ public DateBuilder setDate(String year, String month, String day) {
+ return setDate(Integer.parseInt(year), Integer.parseInt(month), Integer.parseInt(day));
+ }
+
+ public DateBuilder setDateReverse(String day, String month, String year) {
+ return setDate(year, month, day);
+ }
+
public DateBuilder setHour(int hour) {
calendar.set(Calendar.HOUR_OF_DAY, hour);
return this;
@@ -79,6 +91,10 @@ public class DateBuilder {
return setHour(hour).setMinute(minute).setSecond(second);
}
+ public DateBuilder setTime(String hour, String minute, String second) {
+ return setTime(Integer.parseInt(hour), Integer.parseInt(minute), Integer.parseInt(second));
+ }
+
public DateBuilder setTime(int hour, int minute, int second, int millis) {
return setHour(hour).setMinute(minute).setSecond(second).setMillis(millis);
}
@@ -87,7 +103,7 @@ public class DateBuilder {
return setDate(year, month, day).setTime(hour, minute, second);
}
- public Date build() {
+ public Date getDate() {
return calendar.getTime();
}