# datediff

Source: https://zotonic.com/docs/1497/datediff

URI: https://zotonic.com/id/1497

Language: en



Calculate the difference between two dates, returning a single part of that difference.

The filter takes a list with 2 parts \[start, end\] as date range argument.

The filter argument the “part” that will be extracted, and is one of Y, M, D, H, I, S.

Example, where start = 2012-02-02, end = 2012-03-01:

```django
{{ [end, start]|datediff:"M" }}
```

Returns 1, since the difference in months between those 2 dates is 1.

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/1497?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/1497?language=en>)
