Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 343507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:54:14+00:00 2026-05-12T10:54:14+00:00

In my application users should be able to define dates when they are available.

  • 0

In my application users should be able to define dates when they are available. Ie. user joe may define he’s available:
– at every monday, wednesday and sunday between 15:00 and 17:00 from 1.09.2009 to 15.11.2009.
– at 2.09.2009 between 12:00 and 14:00
and so on…

Dates may be defined maximum 1 year in future.

Users may add, edit and delete defined dates.

Other users may search available users ie.
– find all users available 8.09.2009 at 15:30

The problem is how to design sql tables, which allow creating and editing cyclic dates and efficient searching.

I’m using postgresql but rather looking for any guidelines. Maybe someone has experience with similar problem?

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T10:54:15+00:00Added an answer on May 12, 2026 at 10:54 am

    When I’ve dealt with data like this before, I’ve taken a “rules” approach similar to this to accomodate by-day scheduling and block scheduling:

    CREATE TABLE availability_rules (
      id SERIAL UNIQUE,
      user_id NOT NULL REFERENCES users(id),
      day_of_week INTEGER CONSTRAINT valid_day_of_week CHECK (day_of_week BETWEEN 0 and 6)
      start_time TIME,
      start_date DATE,
      end_time TIME,
      end_date DATE
    );
    

    Note: You would need to add additional constraints to the rules table to make sure that end_date + end_time >= start_date + start_time, etc.

    Then, you can create an “availability” view to generate a normalized schedule with user_id, date, start_time, and end_time. Using 8.4, this is easy with the new generate_series datetime capabilities. (http://www.postgresql.org/docs/current/static/functions-srf.html) It is easy enough to write a function that does the same thing if you’re on 8.3 or earlier.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 271k
  • Answers 271k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer No, you should not try to write your own XML… May 13, 2026 at 1:37 pm
  • Editorial Team
    Editorial Team added an answer Finally I came to know why I am getting this… May 13, 2026 at 1:37 pm
  • Editorial Team
    Editorial Team added an answer Looks like in the first for-i loop, i starts at… May 13, 2026 at 1:37 pm

Related Questions

I have an application built upon ASP.NET 3.5 and PostgreSQL 8.3. My database has
I'm trying to understand how graphics card versions, OpenGL versions and the API headers
In my application, there are 10-20 classes that are instantiated once[*]. Here's an example:
I'm looking for a way to create some kind of value type hierarchical class

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.