# Time interval between two date columns

**URL:** <https://community.datagrok.ai/t/time-interval-between-two-date-columns/51>\
**Category:** Questions\
**Created:** [March 10, 2020, 3:39pm UTC](https://community.datagrok.ai/t/time-interval-between-two-date-columns/51 "2020-03-10T15:39:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SBrown](https://community.datagrok.ai/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@SBrown](https://community.datagrok.ai/u/SBrown)\
**Post date:** [March 10, 2020, 3:39pm UTC](https://community.datagrok.ai/t/time-interval-between-two-date-columns/51/1 "2020-03-10T15:39:11Z")

</div>

I have a dataset with two date column, ‘start\_date’ and ‘end\_date’. Is there a way to easily create  
a ‘duration (days)’ column?

---

<div class="post-metadata">

**Author:** ![osakhniuk](https://community.datagrok.ai/user_avatar/community.datagrok.ai/osakhniuk/32/12_2.png) [@osakhniuk](https://community.datagrok.ai/u/osakhniuk)\
**Post date:** [March 10, 2020, 3:56pm UTC](https://community.datagrok.ai/t/time-interval-between-two-date-columns/51/2 "2020-03-10T15:56:04Z")

</div>

Use `DateDifferenceWithColumn` function. For your particular case, execute the following command from the [console](https://datagrok.ai/help/overview/console) ( **View | Console** ):

`DateDifferenceWithColumn("table_name", "start_date", "end_date", "duration (days)", "days")`

Please note that the last parameter - `units` can take the following values: years | months | weeks | days | hours | minutes | seconds | milliseconds
