Generate and return the number of leap years within the closed year interval [since, until]
where since
represents the origin year, and until
represents a later year after since
.
- Parameters
-
[in] | until | : The input scalar or array of arbitrary rank of type integer of default kind IK, containing the Gregorian Calendar year up to which the number of leap years since since must be returned.
If until < 0 , then the number of leap years from the negative year until January, 1, 1 is returned. |
[in] | since | : The input scalar or array of the same shape as until of the same type and kind as until , containing the Gregorian Calendar year that marks the beginning of the period within which the number of leap years must be counted.
(optional, default = 1_IK , i.e., the origin of the Gregorian Calendar.) |
Possible calling interfaces ⛓
integer(IK) :: countLeapYear
Generate and return the number of leap years within the closed year interval [since,...
This module contains classes and procedures for computing, manipulating, and styling dates and times.
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
- Warning
- The condition
0 < since < until
must hold for the input argument values.
These conditions are verified only if the library is built with the preprocessor macro CHECK_ENABLED=1
.
-
The
pure
procedure(s) documented herein become impure
when the ParaMonte library is compiled with preprocessor macro CHECK_ENABLED=1
.
By default, these procedures are pure
in release
build and impure
in debug
and testing
builds.
- See also
- getCountDays
Example usage ⛓
12 integer(IK),
allocatable :: Year(:)
13 type(display_type) :: disp
17 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
18 call disp%show(
"! Determine if a given Gregorian calendar date is the last of the month.")
19 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
23 call disp%show(
"getCountLeapYears(until = 1_IK)")
28 call disp%show(
"getCountLeapYears(until = 2000_IK)")
35 call disp%show(
"getCountLeapYears(until = getYear())")
42 call disp%show(
"getCountLeapYears(until = getYear(), since = 1_IK)")
47 call disp%show(
"getCountLeapYears(until = [1_IK, 2_IK, 3_IK, 4_IK])")
52 call disp%show(
"Year = getRange(-5_IK, 5_IK, 1_IK)")
56 call disp%show(
"getCountLeapYears(until = Year, since = -5_IK)")
61 call disp%show(
"Year = getRange(-8_IK, 8_IK, 1_IK)")
65 call disp%show(
"getCountLeapYears(until = Year)")
72 call disp%show(
"getCountLeapYears(until = getYear(), since = 1_IK)")
79 call disp%show(
"getCountLeapYears(until = getYear(), since = [1999_IK, 2000_IK, 2001_IK])")
Generate minimally-spaced character, integer, real sequences or sequences at fixed intervals of size ...
This is a generic method of the derived type display_type with pass attribute.
This is a generic method of the derived type display_type with pass attribute.
Generate and return the conversion of the input value to an output Fortran string,...
This module contains procedures and generic interfaces for generating ranges of discrete character,...
integer(IK) function getYear()
Generate and return the current year of the Gregorian calendar.
This module contains classes and procedures for input/output (IO) or generic display operations on st...
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
This module contains the generic procedures for converting values of different types and kinds to For...
Generate and return an object of type display_type.
Example Unix compile command via Intel ifort
compiler ⛓
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example Windows Batch compile command via Intel ifort
compiler ⛓
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
Example Unix / MinGW compile command via GNU gfortran
compiler ⛓
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example output ⛓
33-5,
-4,
-3,
-2,
-1,
+0,
+1,
+2,
+3,
+4,
+5
35+0,
+1,
+1,
+1,
+1,
+2,
+2,
+2,
+2,
+3,
+3
40-8,
-7,
-6,
-5,
-4,
-3,
-2,
-1,
+0,
+1,
+2,
+3,
+4,
+5,
+6,
+7,
+8
42-3,
-2,
-2,
-2,
-2,
-1,
-1,
-1,
-1,
+0,
+0,
+0,
+1,
+1,
+1,
+1,
+2
- Test:
- test_pm_dateTime
Final Remarks ⛓
If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.
-
If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
-
If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.
This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.
- Copyright
- Computational Data Science Lab
- Author:
- Amir Shahmoradi, March 22, 2012, 00:00 AM, National Institute for Fusion Studies, The University of Texas Austin
Definition at line 3783 of file pm_dateTime.F90.