Bases : trying to get year out of propery date

What I’m trying to do

I would like to calculate between the current date and a date in note, trying to get the year in a new collom in bases.

Can bases calculate dates?

I have a property in note which is date there is the date of a scheduled agenda, now i would like to calculate this date with the current date and i want the output in years.

Example i have a note from 2005 (passing my dad ) now its 2025, can bases calculate and show now 20 years in a collom?
It could be handy for birthdays (see the age ) or people who passed away.

thank you

Things I have tried

i not so very good in formulas, trying to search a lot in this forum , found
(date(propery.date) -date(now()))

i have no idea i tried no results

Thanks

Hello.

If you copy and paste the text below into a new note, does it help as an example Base for you to work with?

---
dob: 1934-06-11
dod: 2009-08-25
---
```base
formulas:
  age: today() - dob
  years since death: today() - dod
  age when died: dod - dob
properties:
  formula.age:
    displayName: age today
views:
  - type: table
    name: Table
    filters:
      and:
        - "!dob.isEmpty()"
    order:
      - file.name
      - formula.age
      - formula.age when died
      - formula.years since death
    sort:
      - property: formula.age when died
        direction: ASC
    columnSize:
      file.name: 164
      formula.age: 135

```

And below is a link to a more detailed Base for birthdays:

Reddit – Birthday Base

2 Likes

Hello,

This is exact what i was looking for , i learn much from it.

I have made some changed and it works perfect!!!

Thanks a lot.

1 Like