Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add derived types for date and date/time #861

Open
Beliavsky opened this issue Aug 14, 2024 · 0 comments
Open

Add derived types for date and date/time #861

Beliavsky opened this issue Aug 14, 2024 · 0 comments

Comments

@Beliavsky
Copy link

Beliavsky commented Aug 14, 2024

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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant