# Comparing dates

**URL:** <https://forum.servoy.com/t/comparing-dates/3513>\
**Category:** Classic Servoy\
**Created:** [January 21, 2005, 3:29pm UTC](https://forum.servoy.com/t/comparing-dates/3513 "2005-01-21T15:29:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Morley](https://avatars.discourse-cdn.com/v4/letter/m/7cd45c/32.png) [@Morley](https://forum.servoy.com/u/Morley)\
**Post date:** [January 21, 2005, 3:29pm UTC](https://forum.servoy.com/t/comparing-dates/3513/1 "2005-01-21T15:29:03Z")

</div>

I have a datetime field which contains both date and time. I need to create a relationship to just the date portion (day, month, year, disregard time). Presumably this requires a calculation. But I’ve been unable to locate the appropriate syntax.

Separate matches for each of day, month, year (which would require separate calcs for each)? Or is there something more efficient?

Thanks

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [January 22, 2005, 9:54am UTC](https://forum.servoy.com/t/comparing-dates/3513/2 "2005-01-22T09:54:18Z")

</div>

set the time proportion to 0

```auto
calculation:
var a = date
a.setHours(0)
a.setMinutes(0)
a.setSeconds(0)
a.setMilliseconds(0)
return a

```

Do this this for both sides of the relation (left and right) and you can use them in a relation!

---

<div class="post-metadata">

**Author:** ![Morley](https://avatars.discourse-cdn.com/v4/letter/m/7cd45c/32.png) [@Morley](https://forum.servoy.com/u/Morley)\
**Post date:** [January 22, 2005, 4:22pm UTC](https://forum.servoy.com/t/comparing-dates/3513/3 "2005-01-22T16:22:45Z")

</div>

Excellent, Harjo! Thanks.
