Skip to content

Commit

Permalink
Update DateTime.java
Browse files Browse the repository at this point in the history
  • Loading branch information
youfanx committed Jul 10, 2024
1 parent 9b22dd1 commit b2f62eb
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions rxlib/src/main/java/org/rx/bean/DateTime.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ public DateTime(int year, Month month, int day, int hour, int minute, int second
}
}

public DateTime(long ticks) {
this(ticks, null);
}

public DateTime(long ticks, TimeZone zone) {
super(ticks);
if (zone != null) {
Expand Down Expand Up @@ -237,11 +241,11 @@ public DateTime setTimePart(String time) {
return DateTime.valueOf(toString("yyy-MM-dd " + time), DATE_TIME_FORMAT, getTimeZone());
}

// public boolean isToday() {
// DateTime n = DateTime.now();
// n.setTimeZone(getTimeZone());
// return n.getYear() == getYear() && n.getMonth() == getMonth() && n.getDay() == getDay();
// }
public boolean isToday() {
DateTime n = DateTime.now();
n.setTimeZone(getTimeZone());
return n.getYear() == getYear() && n.getMonth() == getMonth() && n.getDay() == getDay();
}

public DateTime addYears(int value) {
return add(Calendar.YEAR, value);
Expand Down

0 comments on commit b2f62eb

Please sign in to comment.