Calculate date from future date

Hi,
I would like a formula that calculate how many weeks and day we are from a future date. Used in pregnancy.
Example: Fixed date is August 21-2021 (I will set that up in the begining), formula is to calculate August 21 2021 minus today's date and give me the result in weeks and days (like 34 weeks and five days)

Hi, and welcome to the forum! :slight_smile:

Here is an example to do what you want:

Let us know if you have any questions.

Hi,
Thanks for your reply. I don't get it though. The example mentioned is about the budget.
Here is what I need
Patient last menstrual period date (LMP)
Patient Estimated date of delivery (EDC)
EDC by LMP is calculated by adding 280 days (40 weeks) to the first day of the last menstrual period.

Then today's date is known. How do I calculate the difference between today's date and the EDC and give me the results in weeks and days?

For your specific example, you could do something like:

LMP: {formdate: YYYY-MM-DD; name=LMP}

{EDC_TIMESTAMP={time: X; at={=LMP}} + 280 * 24 * 60 *60}
EDC: {time: LL; at={=EDC_TIMESTAMP}; pattern=X}

{TIME_FROM_NOW_SECONDS=EDC_TIMESTAMP - {time: X}}
Time from now: {=TIME_FROM_NOW_SECONDS / 24 / 60 /60; format=.0f} days