I was trying to do the same thing just now and found this thread. The problem with the solutions outlined above (unless I'm being thick, which is always a possibility) is accounting for all the edge cases. E.g. if a product is created on the last day of the year, the numeric difference when comparing dates in YYMMDD format will be 8870, whereas the difference between two products created on two sequential days in the same month will be 1. So you have to do a lot of if/else to make it work in all cases. What I couldn't see documented anywhere is that Liquid seems to support the '%s' format directive to output a date as the number of seconds since Jan 1st 1970. This means you can do (date1 | Date:'%s') - (date2 | Date:'%s') and get a difference between the two in seconds, making life much easier as 1 day always equals (60*60*24) seconds regardless of what year/month boundaries it crosses. Hope this helps someone!
... View more