With the first we have created a series of custom fields containing start (ecpt_data-consegna) and end (ecpt_data-dismissione) dates, and we would like to find a way to show the time difference between those dates - shown as XX years, XX months, XX days - in a cell of a table generated through the Advanced Post List plugin. Please note that shall the eding date be missing, the difference should be calculated between the starting date and the current date (now).

After much chatting with both plugins' developers, we came to a standstill. Currently we have developed a custom PHP function to handle the date calculations as follows:

1 Answer
1

I don't know how much this will help, but when I've done date/time comparisons, I've always had to convert them to UNIX timestamps first (converts the date/time to a numeral, which you can compare as less than/greater than/equal to the next number), and then after the difference is sorted, convert it back with date().

A simple example (not of your code, but of a quickie I did for a client a couple of years ago) was to do this:

Thanks Shelly for your suggestion, but in the opening post I didn't mention that the Easy Content Types plugin does already convert all the dates to UNIX timestamps. So that step has been done already.
–
Diego MeozziOct 30 '12 at 13:42

Ah, well that makes a difference then ;) I'm not familiar with the plugin though - have you tried contacting the plugin authors? Maybe it's a bug they're aware of?
–
ShellyOct 30 '12 at 17:08

Well, I have already contacted the authors of both plugin, but as I'd like to use a custom function, that is clearly outside their support duties...
–
Diego MeozziOct 31 '12 at 15:34