Thread: "Day" from 8am to 3am
Hi folks, I have a special application that considers a playday to be from 8am to 3pm the next morning. The system then does maintenance from 3am till 8am (if necessary). I'd like to ease application development by creating a new kind of "playDay" to query from. For example: SELECT * FROM table WHERE timestamp IN date_trunc('playDay', timestamp); Any ideas? Where should I begin? Or is this all just wrongheaded and should I put it on the application level? -judd
Judd Maltin <judd@maltin.org> writes: > I have a special application that considers a playday to be from 8am to > 3pm the next morning. The system then does maintenance from 3am till 8am > (if necessary). 8am is in the eye of the beholder. Why not run the system in a timezone selected such that a playday starts at local midnight? regards, tom lane
On Wed, 6 Jun 2001, Tom Lane wrote: > Judd Maltin <judd@maltin.org> writes: > > I have a special application that considers a playday to be from 8am to > > 3pm the next morning. The system then does maintenance from 3am till 8am > > (if necessary). > > 8am is in the eye of the beholder. Why not run the system in a timezone > selected such that a playday starts at local midnight? > > regards, tom lane Isn't changing the system for the application breaking a cardinal rule of systems design? I need the real time of day anyway.. I just want to make SELECTs easier. -judd