# How to apply validation on time

**URL:** https://discuss.tryton.org/t/how-to-apply-validation-on-time/2111
**Category:** Developer
**Created:** [December 23, 2019, 6:02am UTC](https://discuss.tryton.org/t/how-to-apply-validation-on-time/2111 "2019-12-23T06:02:29Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![prashasti.sharma](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/p/58f4c7/32.png) [@prashasti.sharma](https://discuss.tryton.org/u/prashasti.sharma)
#### Post date: [December 23, 2019, 6:02am UTC](https://discuss.tryton.org/t/how-to-apply-validation-on-time/2111/1 "2019-12-23T06:02:29Z")

</div>

Sir, how to apply validation on time field so that it takes the entry from 8:00 am of the present day to 7:00am of next day.

Any help will be appreciable.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [December 23, 2019, 8:47am UTC](https://discuss.tryton.org/t/how-to-apply-validation-on-time/2111/2 "2019-12-23T08:47:52Z")

</div>

Is it time or datetime?  
Any way, you can set a domain on the field.

---

<div class="post-metadata">

### Author: ![prashasti.sharma](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/p/58f4c7/32.png) [@prashasti.sharma](https://discuss.tryton.org/u/prashasti.sharma)
#### Post date: [December 23, 2019, 8:55am UTC](https://discuss.tryton.org/t/how-to-apply-validation-on-time/2111/3 "2019-12-23T08:55:33Z")

</div>

Sir, i need to measure patients hourly data in terms of hours by hours in the form view that is from present day’s entry morning 8:00 am to next day 7:00 am. Code is given below:

`time_of_measurement = fields.Time('Time At Measurement(hr/hrs)', format="%H")`

But on applying this time is coming in terms of 00:00 to 24:00 and i need to show in form view like present day’s entry morning 8:00 am to next day 7:00 am.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [December 23, 2019, 6:01pm UTC](https://discuss.tryton.org/t/how-to-apply-validation-on-time/2111/4 "2019-12-23T18:01:20Z")

</div>

Then by convention you can cover all cases, if the time is before 8:00 it is on the next day.  
But by experience, it is usually better to store datetime if you want to store when something happened.
