years_since

Years since given date (truncated)

years_since(date)

Parameters

Name Type Description
date date A date value (e.g., `first_trade_date`)

Formula

Uses PostgreSQL's AGE function:
```
years_since = EXTRACT(YEAR FROM AGE(scan_date, date))
```

Examples

// Stocks that started trading within the last year
years_since(first_trade_date) < 1;

// Stocks with at least 5 years of trading history
years_since(first_trade_date) >= 5;

Returns

Integer (complete calendar years)