Total number of days between 2 dates

[ad_1]

Hello @pexel

If you have two date fields (for example fieldname1 and fieldname2), the processes is very simple.

# of days:

ABS(fieldname1-fieldname2)

# of weeks

ABS(fieldname1-fieldname2)/7

If any of the operands are not date fields, for example, to get the difference between a date field and the textual date like 28/01/2010, you can use the DATEDIFF operation:

DATEDIFF(fieldname1, '28/01/2010', 'dd/mm/yyyy', 'd')['days']

For the # of weeks it would be similar:

DATEDIFF(fieldname1, '28/01/2010', 'dd/mm/yyyy', 'd')['days']/7

Best regards.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer