Given a java.util.Date(), how do you create a Calendar object using the Spring Expression Language?
This one works:
<property name="calendarObject" value="#{new java.util.GregorianCalendar()}"/>
but I need to feed the day, month, and year to its constructor from the java.util.Date() date that I have. I would like to use the java.util.Date().getDay() method but apparently it's already deprecated.
I tried using the Calendar.setTime() method but it doesn't work since its return type is void.
You can also call the getTime() method which is inherited like this
value="#{new java.util.GregorianCalendar().getTime()}
and its possible to set a date like this
new java.util.GregorianCalendar(1980,01,01).getTime()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With