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 8362921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:03:19+00:00 2026-06-09T12:03:19+00:00

If I give 2 dates, I need results as follow – SUNDAY = 3

  • 0

If I give 2 dates, I need results as follow –

SUNDAY = 3 TIMES
MONDAY = 3 TIMES
TUESDAY = 4 TIMES
WEDNESDAY = 4 TIMES
THURSDAY = 4 TIMES
FRIDAY  = 4 TIMES
SATRUDAY = 4 TIMES

I am confused if this can be done via any function in mysql or I have to do it from php.
I tried with various ways in mysql but could not get any success. I am trying it in php but the codes is somewhat getting lengthy.

  • 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-09T12:03:20+00:00Added an answer on June 9, 2026 at 12:03 pm

    Try;

    define('ONE_WEEK', 604800); // 7 * 24 * 60 * 60
    
    function number_of_days($day, $start, $end)
    {
        $w = array(date('w', $start), date('w', $end));
    
        return floor( ( $end - $start ) / ONE_WEEK ) + ( $w[0] > $w[1] ? $w[0] <= $day || $day <= $w[1] : $w[0] <= $day && $day <= $w[1] );
    }
    
    //$start = $end = time();
    
    echo number_of_days(0, $start, $end); // SUNDAY
    echo number_of_days(1, $start, $end); // MONDAY
    echo number_of_days(2, $start, $end); // TUESDAY
    echo number_of_days(3, $start, $end); // WEDNESDAY
    echo number_of_days(4, $start, $end); // THURSDAY
    echo number_of_days(5, $start, $end); // FRIDAY
    echo number_of_days(6, $start, $end); // SATURDAY
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone give me any pointers. I have a text file that contains dates
Original I don't get why the Where() clause doesn't give me the right results
Basically, I'm using WebGrid and I need to filter the results. The first problem
I have a service that give me a date time string in the following
I am looking for javascript code which will give me 1st date of the
I want to find a date after a give weeks(months). For example, I want
these below codes give whole data of my Rehber datas. But if i want
Im having a hard tim getting the NSDateFormatter to give me a correct date
give me suggestion which is related to table view selection action. I have a
Give a linear-time algorithm to test whether a tree has a perfect matching, that

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.