Julian Day 与 Date 对象以获得当前日期

Julian Day vs the Date object to get the present day

在提及特定课程时,我遇到了以下代码来检索当天:

int julianStartDay = Time.getJulianDay(System.currentTimeMillis(),   dayTime.gmtoff);
long dateTime;
dateTime = dayTime.setJulianDay(julianStartDay);
day = getReadableDateString(dateTime);

     private String getReadableDateString(long time){
          SimpleDateFormat shortenedDateFormat = new SimpleDateFormat("E MMM d");
            return shortenedDateFormat.format(time);
        }

我的疑惑是为什么我们要使用这个 julian 方法而不是直接从提供当前日期和时间的 Date class 对象中提取日期。

您的申请与东正教宗教日历有关吗?据我所知,这是 Julian calendar 唯一仍在使用的地方。

JavaDateCalendar类默认使用Gregorian calendar。 (Calendar.getInstance 方法 return 一个 GregorianCalendar 对象,除非指定了两个特定语言环境之一。)如果您的应用程序需要改用儒略历,那将解释此实现。