Jess Information

Jess Home
Jess 7 Features
Download Now!
Online Demo

Mailing List
Jess Wiki

More information Related Web Sites
User Contributions
JSR94 Info
Developer's Log
About This Site

JESS ®, the Rule Engine for the JavaTM Platform

Jess Wiki: Working With Dates

Jess doesn’t have a standard way of representing and working with dates. As a result, you will need to represent dates as either a long millisecond time or a reference to an external Java java.util.Calendar or java.util.Date object. Personally, I feel that the long millisecond time is easier since you will be able to use the numerical comparison and arithmetic functions directly. It will also require fewer external Java calls. Whichever representation you use, try to stay consistent. Don't mix different representations within your program, it will only cause problems. The following Jess snippets should help.

GetTimeInMillis Get the time in milliseconds.
GetCalendarObject Get the java.util.Calendar object that represents the time.
MinTime Return the minimum time value.
MaxTime Return the maximum time value.
StrTime Converts the given time into its string representation.
StrTimeShort Converts the given time into its short string representation.
StrTimeLong Converts the given time into its short string representation.
DiffTime Returns the difference between two times in milliseconds.
AddTime Add to the time the specified amount of time to the given java.util.Calendar field.
GetTimeValue Get the specified java.util.Calendar field from the time.
SetTimeValue Set the specified java.util.Calendar field to the value in the given time.

Submitted by:
Union Pacific Railroad


Front Page | Sandbox | Recent Changes | Powered by Friki | Last Edited: 18 August 2006