johnhomsea commented on a change in pull request #223: HBASE-22368 Use
LocalDate instead of Date for MobUtil class
URL: https://github.com/apache/hbase/pull/223#discussion_r285487698
##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobUtils.java
##########
@@ -113,79 +111,71 @@ private MobUtils() {
/**
* Formats a date to a string.
+ *
* @param date The date.
* @return The string format of the date, it's yyyymmdd.
*/
- public static String formatDate(Date date) {
- return LOCAL_FORMAT.get().format(date);
+ public static String formatDate(LocalDate date) {
+ return DATE_TIME_FORMATTER.format(date);
+ }
+
+ public static String formatDate(long millisecond) {
+ return formatDate(toLocalDate(millisecond));
+ }
+
+ private static LocalDate toLocalDate(long millisecond) {
+ return
Instant.ofEpochMilli(millisecond).atZone(ZoneId.systemDefault()).toLocalDate();
Review comment:
Yes, the Date class just use the JVM timezone
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services