BokkyPooBahsDateTimeLibrary icon indicating copy to clipboard operation
BokkyPooBahsDateTimeLibrary copied to clipboard

Suggestions for additional features

Open zemingyu opened this issue 6 years ago • 2 comments

SAS has a comprehensive list of date time functions which you can find here: http://support.sas.com/documentation/cdl/en/etsug/63939/HTML/default/viewer.htm#etsug_intervals_sect014.htm

Some of the most commonly used features are:

  • work out the number of week/months/quarter... between two dates. This can be done on a continuous basis or on a discrete basis. (SAS intck() function)

For the DISCRETE method, the distance in MONTHS between January 31, 2000, and February 1, 2000, is one month. The CONTINUOUS (or CONT or C) method uses continuous time intervals. For the CONTINUOUS method, the distance in MONTHS between January 15, 2000, and February 14, 2000, is zero, but the distance in MONTHS between January 15, 2000, and February 15, 2000, is one month.

  • take any date and find the month end/quarter end/year end, or 1st day of the month/quarter/year. The year can be specified to be a financial year ending any month e.g. 31 Mar, 60 Jun, 31 Dec (SAS intnx() function)

  • convert to/from a wide range of date time formats. See the two big tables here: https://v8doc.sas.com/sashtml/lrcon/zenid-63.htm

Some other features that might be useful are

  • public holiday/ school holiday lookup (this varies by location)

If you think these features are useful I can help building some of them.

zemingyu avatar May 30 '18 12:05 zemingyu

I would like this first version to be simple and small to deploy. Once it has been used, we can improve on it. Regarding holidays, this is very region dependent and should be a separate library built on top of this lower level functions.

bokkypoobah avatar May 30 '18 14:05 bokkypoobah

I would love to be able to add or sub intervals following ISO8601 durations https://en.wikipedia.org/wiki/ISO_8601#Durations

Here one PHP example http://php.net/manual/fr/class.dateinterval.php <?php $date = new DateTime('2000-01-01'); $date->add(new DateInterval('P10D')); ?>

Great job !

mvanmeerbeck avatar Mar 08 '19 15:03 mvanmeerbeck