# What is the Best way to define Shifts using db Time Stamp

**URL:** <https://forum.inductiveautomation.com/t/what-is-the-best-way-to-define-shifts-using-db-time-stamp/41303>\
**Category:** Ignition\
**Tags:** database, ignition79\
**Created:** [December 8, 2020, 5:18pm UTC](https://forum.inductiveautomation.com/t/what-is-the-best-way-to-define-shifts-using-db-time-stamp/41303 "2020-12-08T17:18:56Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 17, 2021, 10:06pm UTC](https://forum.inductiveautomation.com/t/what-is-the-best-way-to-define-shifts-using-db-time-stamp/41303/13 "2021-09-17T22:06:08Z")

</div>

Another poster prompted me to dig my solution out of my archive. Posted over there:

> [@Script for periodically changing shift time](https://forum.inductiveautomation.com/t/script-for-periodically-changing-shift-time/51058/3):
>
> Hi Berkay, I like to solve this kind of problem with a smart database, like PostgreSQL, where I can define a pattern and repeat it with table generating functions. I tweaked one of my implementations to serve as an example: create table shift\_schedules (shift\_id serial, shift\_name varchar(255), refdate date, repeat int, tzname varchar(255), primary key (shift\_id)); insert into shift\_schedules (shift\_name, refdate, repeat, tzname) values ('Berkay Cinar 3wk', '2021-07-26', 21, 'America/Ne…

---

_[View the full topic](https://forum.inductiveautomation.com/t/what-is-the-best-way-to-define-shifts-using-db-time-stamp/41303)._
