Re: JESS: Get the current year

"Donald Winston" <[email protected]>
Newsgroups gmane.comp.java.jess
Message-ID <15543_1283313785_o8142TU4017015_0EE3B457-F9CA-408C-833C-31CA80B395E1@yahoo.com>
There's some math functions but no date functions. see    Jess71p2-1/docs/function_index.html
You can use java from Lisp to do this. 

(bind ?ms ((new java.util.Date) getTime))
(bind ?year (integer (+ 1970 (/ (/ (/ (/ (/ ?ms 1000) 3600) 24) 365.25 )))))
(printout t ?year crlf)

getTime() is deprecated. The proper way to get the time is from java.util.Calendar. 
 
int year = Calendar.getInstance().get(Calendar.YEAR);

But you have to use static methods. Jess doesn't appear to let you do this.


On Aug 24, 2010, at 12:08 PM, ANA TANASESCU wrote:

> Hello everybody,
> 
> I want to define a rule that makes the difference between the year of the current date and the year from a slot in my ontology.
> Is there a function that gets the current date or the year from the current date?
> 
> I am looking forward for your answer.
> Best regards,
> Ana
> 





--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [email protected]'
in the BODY of a message to [email protected], NOT to the list
(use your own address!) List problems? Notify [email protected].
--------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.