All pastes #341409 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-02-05 16:48 UTC
rendered paste body
 procedure Next_Date(Item : out Date_Type) is
         begin
            if Item.Day+1 < 29 then
               Item.Day := Item.Day+1;
            else
               case Item.Month is
                  when 1|3|5|7|8|10|12 =>
                     if Item.Day+1 <= 31 then
                        Item.Day := Item.Day+1;
                     else
                        Item.Month := Item.Month+1;
                        Item.Day := 1;
                     end if;
                  when 2 =>
                     Item.Month := Item.Month+1;
                     Item.Day := 1;
                  when others =>
                     if Item.Day+1 <= 30 then
                        Item.Day := Item.Day+1;
                     else
                        Item.Month := Item.Month+1;
                        Item.Day := 1;
                     end if;
               end case;
               if Item.Month > 12 then
                  Item.Year := Item.Year+1;
                  Item.Month := 1;
               end if;
            end if;
            end Next_Date;