tracker issue : CF-3684150

select a category, or use search below
(searches all categories and all time range)

Add ability to dateAdd() with non-whole-numbers

| View in Tracker

Status/Resolution/Reason: To Fix//

Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron (Adam Cameron)

Created: 12/13/2013

Components: Language

Versions: 2016,11.0,10.0

Failure Type: Enhancement Request

Found In Build/Fixed In Build: Final /

Priority/Frequency: Trivial / Unknown

Locale/System: English / Platforms All

Vote Count: 1

Currently dateAdd() accepts only integers for the second argument: how much to add/subtract.

It would be very handy to be able to add fractional amounts. For example being able to dateAdd() a timespan() (which is a number of days, as a decimal), or perhaps one has a number of hours which could include fractions, and it's just more work than should be necessary to turn that into hours / minutes / seconds. dateAdd() should do that for us.


----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3684150

External Customer Info:
External Company:  
External Customer Name: Adam Cameron.
External Customer Email:  
External Test Config: My Hardware and Environment details:



Instead of fractional amounts, something like dateAdd("d/h","2/3",date); to increase 2 days and 3 hours can be a good alternative.
Comment by Himavanth R.
13840 | May 06, 2014 05:35:42 AM GMT
Blimey... please do not do that. Humans think in numbers, not "special Adobe notation". Just leave it as numbers. That and we've already got createTimespan() to convert from D,H,M,S values to the number this function would expect. You might want to think about a function that accepts all of y,m,d,h,m,s,l and creates an appropriate number too (createDateTimeSpan()? Dunno). It would perhaps better work taking a single struct of params, so one can pass {y=1,s=1} rather than 1,0,0,0,0,1 -- Adam
Comment by External U.
13841 | May 06, 2014 05:41:27 AM GMT
+1 for dateAdd() to accept a createTimeSpan() result for its second parameter. And +1 for createTimeSpan() to be updated to accept years, months and milliseconds - or add createDateTimeSpan() for that purpose. I think I would prefer just adding additional year/month/millisecond parameters to createTimeSpan().
Vote by External U.
13842 | December 14, 2015 09:21:24 PM GMT