コード例 #1
0
ファイル: CalendarDate.java プロジェクト: flovera1/AIWithJava
  public static CalendarDate nativeDateTimeToCalendarDate(long date) {
    {
      int mjd = 0;
      int millis = 0;

      mjd = (int) ((date / 86400000) + 40588);
      millis = (int) (date % 86400000);
      return (CalendarDate.makeCalendarDate(mjd, millis));
    }
  }
コード例 #2
0
ファイル: CalendarDate.java プロジェクト: flovera1/AIWithJava
  /**
   * Create a calendar date with the specified components. <code>year</code> must be the complete
   * year (i.e., a year of 98 is 98 A.D in the 1st century). <code>timezone</code> is a real number
   * in the range -12.0 to +14.0 where UTC is zone 0.0; The number is the number of hours to add to
   * UTC to arrive at local time.
   *
   * @param year
   * @param month
   * @param day
   * @param hour
   * @param minute
   * @param second
   * @param millis
   * @param timezone
   * @return CalendarDate
   */
  public static CalendarDate makeDateTime(
      int year, int month, int day, int hour, int minute, int second, int millis, double timezone) {
    {
      int time = (hour * Stella.MILLIS_PER_HOUR) + (minute * 60000) + (second * 1000) + millis;

      time = ((int) (time - (timezone * Stella.MILLIS_PER_HOUR)));
      return (CalendarDate.makeCalendarDate(
          Stella.julianDayToModifiedJulianDay(Stella.computeJulianDay(year, month, day)), time));
    }
  }