Re: JESS: Get the current year

"ANA TANASESCU" <[email protected]>
Newsgroups gmane.comp.java.jess
Message-ID <2056_1283455920_o82JV9fw002442_636395.34915.qm@web52006.mail.re2.yahoo.com>
Thanks Ernest.
I have used java.util.Date to solved my problem, but your solutions are better.

Ana

--- On Wed, 9/1/10, Ernest Friedman-Hill <[email protected]> wrote:

From: Ernest Friedman-Hill <[email protected]>
Subject: Re: JESS: Get the current year
To: "jess-users" <[email protected]>
Date: Wednesday, September 1, 2010, 7:12 AM

On Aug 31, 2010, at 11:58 PM, Donald Winston wrote:

> int year = Calendar.getInstance().get(Calendar.YEAR);
> 
> But you have to use static methods. Jess doesn't appear to let you do this.
> 


Sure it does! Two different ways to write this:


1)

(import java.util.Calendar)
(bind ?year ((Calendar.getInstance) get (Calendar.YEAR)))

2)

(import java.util.Calendar)
(bind ?year ((call Calendar getInstance) get (get-member Calendar YEAR)))


---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences          Phone: (925) 294-2154
Sandia National Labs
PO Box 969, MS 9012                            [email protected]
Livermore, CA 94550                             http://www.jessrules.com





--------------------------------------------------------------------
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.