Exemple #1
0
     * </pre>
     * <p>
     * This instance is immutable and unaffected by this method call.
     *
     * @param Temporal $temporal the target object to be adjusted, not null
     * @return Temporal the adjusted object, not null
     * @throws DateTimeException if unable to make the adjustment
     * @throws ArithmeticException if numeric overflow occurs
     */
    public function adjustInto(Temporal $temporal)
    {
        if (AbstractChronology::from($temporal)->equals(IsoChronology::INSTANCE()) == false) {
            throw new DateTimeException("Adjustment only supported on ISO date-time");
        }
        return $temporal->with(ChronoField::MONTH_OF_YEAR(), $this->getValue());
    }
    public function __toString()
    {
        return $this->name;
    }
    public function compareTo(Month $other)
    {
        return $this->val - $other->val;
    }
    public function name()
    {
        return $this->__toString();
    }
}
Month::init();