# Vulnerability Age

**URL:** <https://discuss.rapid7.com/t/vulnerability-age/1319>\
**Category:** SQL Queries\
**Created:** [June 29, 2020, 5:53pm UTC](https://discuss.rapid7.com/t/vulnerability-age/1319 "2020-06-29T17:53:13Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![tyler\_schmidtke](https://discuss.rapid7.com/user_avatar/discuss.rapid7.com/tyler_schmidtke/32/226_2.png) [@tyler\_schmidtke](https://discuss.rapid7.com/u/tyler_schmidtke)\
**Post date:** [June 30, 2020, 5:32pm UTC](https://discuss.rapid7.com/t/vulnerability-age/1319/4 "2020-06-30T17:32:03Z")

</div>

@jacob_horning

My apologies - for the data warehouse, you can use some Postgres functions to get the format that you’re looking for.

If you have the date that vulnerability was found, `favf.date`, you can use the [age(timestamp) function](https://www.postgresql.org/docs/12/functions-datetime.html) to get the following example format:

```auto
1 years 7 mons 29 days 23 hours 29 mins 3.564 secs

```

To get the days specifically from this, you could use the following. Note, this syntax is seemingly undocumented, but it will accept the following intervals `years`, `months`, `days`, `hours`, `minutes`, `seconds`.

```auto
age(favf.date, 'days')

```

This will return a floating point value that could be converted to an integer if you want with the following:

```auto
ROUND(age(favf.date, 'days'))::integer

```

There are some of other ways to accomplish this that are documented, but are a bit more verbose.

---

_[View the full topic](https://discuss.rapid7.com/t/vulnerability-age/1319)._
