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

  • SEARCH
  • Home
  • 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 8782011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:27:25+00:00 2026-06-13T20:27:25+00:00

I am trying to create a calendar which enables a user to book certain

  • 0

I am trying to create a calendar which enables a user to book certain times over a period of six weeks.

Is there an easy way in php to do this – at present I am using a number of loops with the following:

$end_of_month=cal_days_in_month(CAL_GREGORIAN, $this_month, $this_year);

this seems clumsy and requires numerous loops to determine changes in month, year etc.

So far I am stumped as to what other method to use as I am sure there is a simple way of doing this.

  • 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-06-13T20:27:26+00:00Added an answer on June 13, 2026 at 8:27 pm

    Use DateTime objects, using the DateTime::add() in combination with DateInterval objects:

    header("Content-type: text/plain");
    
    $date = new DateTime("2012-01-01");
    $one_day = new DateInterval("P1D");
    echo $date->format("Y-m-d") . PHP_EOL;
    for ($i = 0; $i < 42; $i++) {
        $date->add($one_day);
        echo $date->format("Y-m-d") . PHP_EOL;
    }
    

    This example would output all the dates in a six-week period from the initial date. But it’s very flexible and can do whatever you want it to.

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

Sidebar

Related Questions

I'm trying to create simple script that subscribes a user to a company calendar.
I am trying to create an app which has the ability to view calendar
I am trying to create a form which loads upon a user clicking a
I am trying to create a weekly calendar that allows the user to advance
I am trying to create a calendar in android which will display the number
I'm trying to create calendar for android. There is a month switcher (previous/next month).
we are trying to create a calendar function in python. we have created a
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can
Trying to create a macro which can be used for print debug messages when
I'm trying to create a calendar class in php and am having issues returning

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.