Skip to content

Commit

Permalink
Added CF support for millisecond
Browse files Browse the repository at this point in the history
  • Loading branch information
KamasamaK committed Apr 2, 2024
1 parent 2f33882 commit 9d999bd
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 49 deletions.
2 changes: 1 addition & 1 deletion data/en/cf2021.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"related":["arrayPop","arrayPush","arrayReduceRight","arrayShift","arrayUnshift","cfjava","clearTimeZone","generateBCryptHash","generateSCryptHash","getTimeZone","listReduceRight","setTimeZone","stringEach","stringEvery","stringFilter","stringMap","stringReduce","stringReduceRight","stringSome","stringSort","structIsCaseSensitive","verifyBCryptHash","verifySCryptHash"],
"related":["arrayPop","arrayPush","arrayReduceRight","arrayShift","arrayUnshift","cfjava","clearTimeZone","generateBCryptHash","generateSCryptHash","getTimeZone","listReduceRight","millisecond","setTimeZone","stringEach","stringEvery","stringFilter","stringMap","stringReduce","stringReduceRight","stringSome","stringSort","structIsCaseSensitive","verifyBCryptHash","verifySCryptHash"],
"name":"ColdFusion 2021 New Functions and Tags","type":"listing","description":"List of tags and functions added in ColdFusion 2021"
}
3 changes: 2 additions & 1 deletion data/en/millisecond.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
"related": [],
"description": "Returns the milliseconds of the referenced date.",
"params": [
{"name": "date", "description": "date object; for example, now()", "required": true, "default": "", "type": "date", "values": []},
{"name": "date", "description": "date object", "required": true, "default": "", "type": "date", "values": []},
{"name": "timezone", "description": "A datetime object is independent of a specific timezone; it is only an offset in milliseconds from 1970-1-1 00.00:00 UTC (Coordinated Universal Time).<p>The timezone only comes into play when you need specific information like hours in a day, minutes in a hour or which day it is as these calculations depend on the timezone.</p><p>A timezone must be specified in order to translate the date object to something else. If you do not provide the timezone in the function call, it will default to the timezone specified in the Lucee Administrator (Settings/Regional), or the timezone specified for the current request using the function setTimezone().</p><p>You can find a list of all available timezones in the Lucee administrator (Settings/Regional). Some examples of valid timezones include:</p><ul><li>AGT (for time in Argentina)</li><li>Europe/Zurich (for time in Zurich/Switzerland)</li><li>HST (Hawaiian Standard Time in the USA)</li></ul>", "required": false, "default": "", "type": "string", "values": []}
],
"engines": {
"coldfusion": {"minimum_version":"2021", "notes":"", "docs":"https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-m-r/millisecond.html"},
"lucee": {"minimum_version": "", "notes": "", "docs": "https://docs.lucee.org/reference/functions/millisecond.html"}
},
"examples": [],
Expand Down
101 changes: 54 additions & 47 deletions guides/en/member.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,40 @@ The following example depicts the new usage of member functions:
myArray.sort("ASC");

// The member way
var myProductObject = createObject("java", "myJavaclass");
myjavaList = myProductObject.getProductList();
myjavaList.add("newProduct"); // Java API
var myProductObject = createObject("java", "myJavaClass");
myJavaList = myProductObject.getProductList();
myJavaList.add("newProduct"); // Java API

myjavaList.append("newProduct"); // CF API
myjavaList.sort("ASC");
myJavaList.append("newProduct"); // CF API
myJavaList.sort("ASC");

Member Functions can also be chained (on Lucee or CF2018+), for example:

s = "the";
s = s.listAppend("quick brown fox", " ")
.listAppend("jumps over the lazy dog", " ")
.uCase()
.reverse();

result: `GOD YZAL EHT REVO SPMUJ XOF NWORB KCIUQ EHT`

Member functions for the following data types are supported:

- Array
- String
- List
- Struct
- Date
- Spreadsheet
- XML
- Query
- Image
- [Array](#array-member-functions)
- [String](#string-member-functions)
- [List](#list-member-functions)
- [Struct](#struct-member-functions)
- [Date](#date-member-functions)
- [Image](#image-member-functions)
- [Spreadsheet](#spreadsheet-member-functions)
- [XML](#xml-member-functions)
- [Query](#query-member-functions)
- [Numeric](#numeric-member-functions)

CF 2016 changed the return type for append member functions:
`anystruct.append()` returns the appended structure
`anyarray.append()` returns the appended array

- `someArray.append()` now returns the appended array
- `someStruct.append()` now returns the appended structure

## Array member functions

Expand Down Expand Up @@ -258,6 +270,7 @@ CF 2016 changed the return type for append member functions:
- hour : `someVar.hour()`
- lsDateFormat : `someVar.lsDateFormat()`
- lsTimeFormat : `someVar.lsTimeFormat()`
- millisecond : `someVar.millisecond()`
- minute : `someVar.minute()`
- month : `someVar.month()`
- quarter : `someVar.quarter()`
Expand Down Expand Up @@ -416,50 +429,54 @@ When using Query.cfc, you get your results from the execution by using:

- `someVar.getResult()`

## Display and Formatting member functions

- booleanFormat : `someVal.booleanFormat()`
- yesNoFormat : `someVal.yesNoFormat()`

## Numeric member functions

- abs : `someVar.abs()`
- aCos : `someVar.aCos()`
- aSin : `someVar.aSin()`
- acos : `someVar.aCos()`
- asin : `someVar.aSin()`
- atn : `someVar.atn()`
- bitAnd : `someVar.bitAnd(number2)`
- bitMaskClear : `someVar.bitMaskClear(start, length)`
- bitMaskRead : `someVar.bitMaskRead(start, length)`
- bitMaskSet : `someVar.bitMaskSet(mask, start, length)`
- bitAnd : `someVar.bitAnd()`
- bitMaskClear : `someVar.bitMaskClear()`
- bitMaskRead : `someVar.bitMaskRead()`
- bitMaskSet : `someVar.bitMaskSet()`
- bitNOT : `someVar.bitNot()`
- bitOR : `someVar.bitOr(number2)`
- bitSHLN : `someVar.bitSHLN(count)`
- bitSHRN : `someVar.bitSHRN(count)`
- bitXOR : `someVar.bitXor(number2)`
- bitOR : `someVar.bitOr()`
- bitSHLN : `someVar.bitSHLN()`
- bitSHRN : `someVar.bitSHRN()`
- bitXOR : `someVar.bitXor()`
- ceiling : `someVar.ceiling()`
- cos : `someVar.cos()`
- decrementValue : `someVar.decrementValue()`
- exp : `someVar.exp()`
- fix : `someVar.fix()`
- floor : `someVar.floor()`
- formatBaseN : `someVar.formatBaseN(radix)`
- formatBaseN : `someVar.formatBaseN()`
- incrementValue : `someVar.incrementValue()`
- inputBaseN : `someVar.inputBaseN()`
- log : `someVar.log()`
- log10 : `someVar.log10()`
- max : `someVar.max(number2)`
- min : `someVar.min(number2)`
- max : `someVar.max()`
- min : `someVar.min()`
- precisionEvaluate : `someVar.precisionEvaluate()`
- randomize : `someVar.randomize([algorithm])`
- randRange : `someVar.randRange(number2[, algorithm])`
- randomize : `someVar.randomize()`
- randRange : `someVar.randRange()`
- round : `someVar.round()`
- sgn : `someVar.sgn()`
- sin : `someVar.sin()`
- sqr : `someVar.sqr()`
- tan : `someVar.tan()`

## Display and Formatting member functions

- booleanFormat : `someVal.booleanFormat()`
- yesNoFormat : `someVal.yesNoFormat()`

## Future member functions

These are exclusively member functions and have no headless equivalent. You use them on the Future returned by `runAsync`.

### Standard Future member functions

- cancel : `FutureObject.cancel()`
- error : `FutureObject.error(UDFMethod method)`
- error : `FutureObject.then((UDFMethod method, long timeout)`
Expand All @@ -471,24 +488,14 @@ When using Query.cfc, you get your results from the execution by using:
- then : `FutureObject.then(UDFMethod method)`
- then : `FutureObject.then((UDFMethod method, long timeout)`

## Empty Future member functions
### Empty Future member functions

- cancel : `EmptyFutureObject.cancel()`
- complete : `EmptyFutureObject.complete(Object val)`
- get : `EmptyFutureObject.get()`
- isCancelled : `EmptyFutureObject.isCancelled()`
- isDone : `EmptyFutureObject.isDone()`

Member Functions can also be chained (on Lucee or CF2018+), for example:

s = "the";
s = s.listAppend("quick brown fox", " ")
.listAppend("jumps over the lazy dog", " ")
.uCase()
.reverse();

result: `GOD YZAL EHT REVO SPMUJ XOF NWORB KCIUQ EHT`

## Important Note on a potential Member Function Gotcha

Some member functions [might fall into underlying Java methods][note] if the strict ColdFusion syntax is not followed.
Expand Down

0 comments on commit 9d999bd

Please sign in to comment.