I’m having trouble working with dates. Here’s what is asked of me to do:
A content type has a Reviewed Date field. On index page, items reviewed in the last X days have to be marked (“New!”).
This is how I approached it:
Created two bindings on the snippet template. One reads current date ($tools.date.getSystemDate()), the other reads Reviewed date from item ($sys.item.getProperty(“rx:date_reviewed”)). The former returns java.util.date, the latter is jcr property. If I do $sys.item.getProperty(“rx:date_last_reviewed”).getDate() I get gregorian calendar type. My idea is to get “time” property for both (number of seconds from set date) so I can compare/subtract the two. I can get that from the current system date ($tools.date.getSystemDate().getTime()) but got nowhere with the calendar.
I am not a java expert and was wondering if someone can help me, or suggest different approach.
Thanks…