IIRC, now() is a java.util.Date object. So you might also try the shortcut method setTime(...). Not at all tested, but in theory:
<cfscript>
// create an instance of a calendar
calendar = createobject("java", "java.util.GregorianCalend
theTime = now().getTime();
calendar.setTime( theTime );
</cfscript>
Main Topics
Browse All Topics





by: _agx_Posted on 2009-03-06 at 03:53:21ID: 23815688
> can not access a member of class java.util.Calendar with modifiers "protected"
.5.0/docs/ api/java/u til/ Gregor ianCalenda r.html#Gre gorianCale ndar()
Calendar is an abstract class and it's constructor is "protected" (ie you cannot call it from outside the java.util package). When you try and use "set", CF automatically tries to call the constructor. Since it is protected, you get an error.
Instead try the GregorianCalendar class. It extends Calendar, so you can use it instead. Also, unlike CF dates the Calendar "month" is 0 based. CF months are 1 based. So remember to subtract 1 from whatever month you pass to the java calendar.
http://java.sun.com/j2se/1
Select allOpen in new window