Period Display
@param  Date
@param  Date - Year
@param  Integer
@param  integer
@return String
189463
public static function periodDisplay($period, $year, $number, $length = 0)
    {
        $periodRange = $this->periodRange($period, $length);

        return $periodRange[$number] . ', ' . $year;
    }
1176971
public static int getYearFromData(Date date) {
		Calendar cal = Calendar.getInstance();
		cal.setTime(date);
		return cal.get(Calendar.YEAR);
	}
460244
def day_of_year(date = self)
      date.month == 1 ? date.day : (DAYS_IN_YEAR[date.month - 2] + date.day)
    end
358508
public static long toMJD(GregorianDate date) {

        return GregorianMath.toMJD(date.getYear(), date.getMonth(), date.getDayOfMonth());

    }
97803
private Integer getIntegerTimeInMinutes(Date date)
   {
      Integer result = null;
      if (date != null)
      {
         Calendar cal = DateHelper.popCalendar(date);
         int time = cal.get(Calendar.HOUR_OF_DAY) * 60;
         time += cal.get(Calendar.MINUTE);
         DateHelper.pushCalendar(cal);
         result = Integer.valueOf(time);         
      }
      return (result);
   }
736277
public final String format(Date date)
    {
        return format(date, new StringBuffer(),
                      DontCareFieldPosition.INSTANCE).toString();
    }
405853
public static Date date(String date) {
		Date result = null;
		try {
			result = getDateFormater(DATE_FORMAT, null).parse(date);
		}
		catch (ParseException pex) {
			LOG.warn("Date not constructable {}", pex, date);
		}
		return result;
	}
269510
public static int getMonthLength(@NotNull final Date date) {
		int year = get(date, Calendar.YEAR);
		int month = get(date, Calendar.MONTH);
		return getMonthLength(year, month);
	}
991198
public static int getDayOfYear(Date date) {
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        return c.get(Calendar.DAY_OF_YEAR);
    }
1255725
public static java.util.Date toDate(String date, String time) {
		if (date == null || time == null)
			return null;
		String month;
		String day;
		String year;
		String hour;
		String minute;
		String second;

		int dateSlash1 = date.indexOf("/");
		int dateSlash2 = date.lastIndexOf("/");

		if (dateSlash1 <= 0 || dateSlash1 == dateSlash2)
			return null;
		int timeColon1 = time.indexOf(":");
		int timeColon2 = time.lastIndexOf(":");

		if (timeColon1 <= 0)
			return null;
		month = date.substring(0, dateSlash1);
		day = date.substring(dateSlash1 + 1, dateSlash2);
		year = date.substring(dateSlash2 + 1);
		hour = time.substring(0, timeColon1);

		if (timeColon1 == timeColon2) {
			minute = time.substring(timeColon1 + 1);
			second = "0";
		} else {
			minute = time.substring(timeColon1 + 1, timeColon2);
			second = time.substring(timeColon2 + 1);
		}

		return toDate(month, day, year, hour, minute, second);
	}
1089504
public String print(ReadablePeriod period) {
        checkPrinter();
        checkPeriod(period);
        
        PeriodPrinter printer = getPrinter();
        StringBuffer buf = new StringBuffer(printer.calculatePrintedLength(period, iLocale));
        printer.printTo(buf, period, iLocale);
        return buf.toString();
    }
448903
public String dateToStringDateFormat(Date date)
   {
       if (date == null)
           return null;
       return gDateFormat.format(date);
   }
1222518
private function getDatesByYearMonthAndPeriodType($dates)
    {
        $result = array();
        foreach ($dates as $date) {
            $yearMonth = ArchiveTableCreator::getTableMonthFromDate($date);
            $result[$yearMonth][null][] = $date->toString();

            // since we're removing all periods, we must make sure to remove year periods as well.
            // this means we have to make sure the january table is processed.
            $janYearMonth = $date->toString('Y') . '_01';
            $result[$janYearMonth][null][] = $date->toString();
        }
        return $result;
    }
697628
function getDateGroup (date) {
  var d = new Date(date);
  var year = d.getFullYear();
  var month = d.getMonth() + 1;
  var day = d.getDate();
  var groups = [];
  groups.push('' + year);
  groups.push('' + year + '-' + (month < 10 ? '0' : '') + month);
  groups.push('' + year + '-' + (month < 10 ? '0' : '') + month + '-' + (day < 10 ? '0' : '') + day);
  return groups;
}
541618
public function getPeriod($date)
    {
        $resultPeriod = null;

        for ($i = count($this->periods) - 1; $i >= 0; $i--) {
            $period = $this->periods[$i];

            if ($period->getEffectiveFrom() <= $date) {
                $resultPeriod = $period;
            }
        }

        return $resultPeriod;
    }
1143524
public static String format(String pattern, Date date) {
	synchronized (data) {
	    Object obj = data.get(pattern);
	    if (obj != null) {
		return ((SimpleDateFormat) obj).format(date);
	    } // print.ln(pattern);
	    SimpleDateFormat sdf = new SimpleDateFormat(pattern);
	    data.put(pattern, sdf);
	    return sdf.format(date);
	}
    }
611659
def get_period(date_from: date, date_to: date) -> str:
    
    assert isinstance(date_from, date)
    assert isinstance(date_to, date)

    str_from: str = date_from.isoformat()
    str_to: str = date_to.isoformat()

    return str_from + " - " + str_to