get_month_ends Function

public pure function get_month_ends(y) result(month_ends)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: y

Return Value integer, dimension(NUM_MONTHS)


Calls

proc~~get_month_ends~~CallsGraph proc~get_month_ends get_month_ends proc~is_leap_year~2 is_leap_year proc~get_month_ends->proc~is_leap_year~2

Called by

proc~~get_month_ends~~CalledByGraph proc~get_month_ends get_month_ends proc~get_month_end get_month_end proc~get_month_end->proc~get_month_ends proc~test_get_month_ends test_get_month_ends proc~test_get_month_ends->proc~get_month_ends proc~is_valid_date~2 is_valid_date proc~is_valid_date~2->proc~get_month_end proc~test_get_month_end test_get_month_end proc~test_get_month_end->proc~get_month_end proc~parse_date parse_date proc~parse_date->proc~is_valid_date~2 proc~test_is_valid_date test_is_valid_date proc~test_is_valid_date->proc~is_valid_date~2 proc~construct_iso8601date construct_ISO8601Date proc~construct_iso8601date->proc~parse_date proc~test_parse_date test_parse_date proc~test_parse_date->proc~parse_date

Source Code

   pure function get_month_ends(y) result(month_ends)
      integer, intent(in) :: y
      integer, parameter :: NUM_MONTHS = 12
      integer, dimension(NUM_MONTHS) :: month_ends
      ! last day numbers of months for leap years
      integer, dimension(NUM_MONTHS) :: MONTH_END_LEAP
      ! last day numbers of months for regular years
      integer, dimension(NUM_MONTHS) :: MONTH_END
      MONTH_END = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
      MONTH_END_LEAP = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

      if(is_leap_year(y)) then
         month_ends = MONTH_END_LEAP
      else
         month_ends = MONTH_END
      endif
   end function get_month_ends