You should use Calendar::DATE instead, since the value is an exposed
constant rather than method.
On Oct 17, 2012 10:19 AM, "Carl Bourne" <carl.bou...@me.com> wrote:

> Hi,
>
> I'm trying to do the equivalent of this in JRuby.
>
>             Calendar cal = Calendar.getInstance();
>             cal.add(Calendar.DATE, -1);
>             Date notBefore = cal.getTime();
>             cal.add(Calendar.DATE, 2);
>             Date notAfter = cal.getTime();
>
> This is my JRuby code:
>
> require 'java'
> cal = java.util.Calendar.getInstance
> cal.add(java.util.Calendar.DATE, -1)
> notBefore = cal.getTime
> cal.add(java.util.Calendar.DATE, 2)
> notAfter = cal.getTime
>
> However, I'm getting the following exception:
>
> NoMethodError: undefined method `DATE' for Java::JavaUtil::Calendar:Class
>
> Am I missing or misunderstanding something here?
>
> Regards,
>
> Carl
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>

Reply via email to