Add derived types for date and date/time
Beliavsky opened this issue · 0 comments
I suggest that stdlib add a derived type for dates (three integer components of year, month, day) called date
and for dates and times, called say date_time
, which could have components matching the arguments of the date_and_time
intrinsic subroutine. The functionality of date
and date_time
could be modeled after Python's datetime.date
and datetime
classes. For dates, Fortran's operator overloading can be useful, allowing dates to be compared with >, >=
etc., dates to be subtracted (giving the number of days between them) and for an integer to be added or subtracted to a date (shifting the date by that many days forward or backward). There should be a function to get the day of week (integer from 1 through 7) from a date. Given a 1D array of dates, you should be able to subsample to get the first or last (or possibly nth) days of the month, quarter, or year.