The siddhi-execution-time extension is an extension to Siddhi that provides time related functionality to Siddhi such as getting current time, current date, manipulating/formatting dates and etc.
Find some useful links below:
Latest API Docs is 4.0.7.
Using the extension in WSO2 Stream Processor
-
You can use this extension in the latest WSO2 Stream Processor that is a part of WSO2 Analytics offering, with editor, debugger and simulation support.
-
This extension is shipped by default with WSO2 Stream Processor, if you wish to use an alternative version of this extension you can replace the component jar that can be found in the
<STREAM_PROCESSOR_HOME>/lib
directory.
Using the extension as a java library
- This extension can be added as a maven dependency along with other Siddhi dependencies to your project.
<dependency>
<groupId>org.wso2.extension.siddhi.execution.time</groupId>
<artifactId>siddhi-execution-time</artifactId>
<version>x.x.x</version>
</dependency>
Branch | Build Status |
---|---|
master |
- currentDate ((Function))
This function returns system time in yyyy-MM-dd format.
- currentTime ((Function))
This function returns system time in in HH:mm:ss format.
- currentTimestamp ((Function))
This function returns system time in yyyy-MM-dd HH:mm:ss format.
- date ((Function))
This function returns date part from a date or date/time expression.
- dateAdd ((Function))
This function returns added specified time interval to a date.If a STRING parameter passed as the first argument then function accepts four parameters with last as optional which is the date.format. If a LONG parameter passed as the first argument, then function accepts three parameters which are timestamp.in.milliseconds,expr,unit in order.
- dateDiff ((Function))
This function returns time(days) between two dates. If two STRING arguments are sent as first two parameters then function should accept four parameters with last two as optional parameters. Parameter order should be dateDiff(date.value1,date.value2,date.format1,date.format2). Else if two LONG arguments are sent as first two parameters then parameter order should be dateDiff(timestamp.in.milliseconds1,timestamp.in.milliseconds2).
- dateFormat ((Function))
This function returns a formatted date string.If the first argument is a STRING then function accepts three parameters with last parameter as a optional parameter.Parameter order should be dateFormat(dateValue,dateTargetFormat,dateSourceFormat). Else if first argument is a LONG then function accepts two parameters.Parameter order should be dateFormat(timestampInMilliseconds,dateTargetFormat).
- dateSub ((Function))
This function returns subtracted specified time interval to a date. If a STRING parameter passed as the first argument then function accepts four parameters with last as optional which is the date.format. If a LONG parameter passed as the first argument, then function accepts three parameters which are timestamp.in.milliseconds,expr,unit in order.
- dayOfWeek ((Function))
This function returns the day on which a given date falls.
- extract ((Function))
This function returns date attributes from a date expression. If the first argument passed is a STRING then the function will accept three arguments with last parameter as optional which is date.format.Parameter order should be extract(unit,date.value,date.format). Else if the first argument passed is a LONG then function accepts two parameters.Parameter order is extract(timestamp.in.milliseconds,unit).
- timestampInMilliseconds ((Function))
This function returns system time or given time in milliseconds.If two STRING parameters are sent as the first argument, the parameter order should be timestampInMilliseconds(date.value,date.format) with last parameter as the optional parameter with is date.format.Else if no argument method invoked then system time will be returned in milliseconds.
- utcTimestamp ((Function))
This function returns System time in yyyy-MM-dd HH:mm:ss format
-
Please report issues at GitHub Issue Tracker.
-
Send your contributions as pull requests to master branch.
-
Post your questions with the "Siddhi" tag in Stackoverflow.
-
Siddhi developers can be contacted via the mailing lists:
Developers List : [email protected]
Architecture List : [email protected]
-
We are committed to ensuring support for this extension in production. Our unique approach ensures that all support leverages our open development methodology and is provided by the very same engineers who build the technology.
-
For more details and to take advantage of this unique opportunity contact us via http://wso2.com/support/.