diff --git a/src/@dates/subperiod.m b/src/@dates/subperiod.m new file mode 100644 index 0000000000000000000000000000000000000000..b85dd2df401d37d41d87167b6c0895f98db5df81 --- /dev/null +++ b/src/@dates/subperiod.m @@ -0,0 +1,20 @@ +function s = year(d) + +% Returns the subperiod (quarter, month or week depending on the frequency). + +% Copyright (C) 2016 Dynare Team +% +% This code is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% Dynare dates submodule is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with Dynare. If not, see <http://www.gnu.org/licenses/>. + +s = d.time(2); \ No newline at end of file diff --git a/src/@dates/subsref.m b/src/@dates/subsref.m index e961d7034c2f101065559261bff68c37e2c9a9aa..627061f65b8ac15ab1398102b9ed8b4d88203c63 100644 --- a/src/@dates/subsref.m +++ b/src/@dates/subsref.m @@ -36,7 +36,7 @@ switch S(1).type error(['dates::subsref: ' S(1).subs ' is not a method but a member!']) end B = builtin('subsref', A, S(1)); - case {'sort','sort_','unique','unique_','double','isempty','length','char','ndat'}% Public methods (without input arguments) + case {'sort','sort_','unique','unique_','double','isempty','length','char','ndat','year','subperiod'}% Public methods (without input arguments) B = feval(S(1).subs,A); if length(S)>1 && isequal(S(2).type,'()') && isempty(S(2).subs) S = shiftS(S,1); diff --git a/src/@dates/year.m b/src/@dates/year.m new file mode 100644 index 0000000000000000000000000000000000000000..df2aad6497a820ace34bcd0e988ee10c6807c1f2 --- /dev/null +++ b/src/@dates/year.m @@ -0,0 +1,20 @@ +function y = year(d) + +% Returns the year. + +% Copyright (C) 2016 Dynare Team +% +% This code is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% Dynare dates submodule is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with Dynare. If not, see <http://www.gnu.org/licenses/>. + +y = d.time(1); \ No newline at end of file