Throwback in dates without Weekends












1














I often use this query1 to go back 6 days on a variable date:



query1 = SELECT
DATE_FORMAT((DATE('2018-11-21') - INTERVAL(S.`I` - 1) DAY), '%Y-%m-%d')
AS VAR
FROM `HELPER_SEQ`
AS S WHERE S.`I` <= 6;


With the help of this auxiliary table with a sequence inserted there.



CREATE TABLE `HELPER_SEQ` (`I` tinyint(3) UNSIGNED NOT NULL);
INSERT INTO `HELPER_SEQ` (`I`) VALUES (1),(2),(3),(4),(5),(6);


Question:



How can I avoid output weekends days using query1?
In a such way that the output go back in 6 useful days, in this example starting on '2018-11-21' the output would be ->



| 2018-11-21 | 
| 2018-11-20 |
| 2018-11-19 |
| 2018-11-16 |
| 2018-11-15 |
| 2018-11-14 |









share|improve this question





























    1














    I often use this query1 to go back 6 days on a variable date:



    query1 = SELECT
    DATE_FORMAT((DATE('2018-11-21') - INTERVAL(S.`I` - 1) DAY), '%Y-%m-%d')
    AS VAR
    FROM `HELPER_SEQ`
    AS S WHERE S.`I` <= 6;


    With the help of this auxiliary table with a sequence inserted there.



    CREATE TABLE `HELPER_SEQ` (`I` tinyint(3) UNSIGNED NOT NULL);
    INSERT INTO `HELPER_SEQ` (`I`) VALUES (1),(2),(3),(4),(5),(6);


    Question:



    How can I avoid output weekends days using query1?
    In a such way that the output go back in 6 useful days, in this example starting on '2018-11-21' the output would be ->



    | 2018-11-21 | 
    | 2018-11-20 |
    | 2018-11-19 |
    | 2018-11-16 |
    | 2018-11-15 |
    | 2018-11-14 |









    share|improve this question



























      1












      1








      1







      I often use this query1 to go back 6 days on a variable date:



      query1 = SELECT
      DATE_FORMAT((DATE('2018-11-21') - INTERVAL(S.`I` - 1) DAY), '%Y-%m-%d')
      AS VAR
      FROM `HELPER_SEQ`
      AS S WHERE S.`I` <= 6;


      With the help of this auxiliary table with a sequence inserted there.



      CREATE TABLE `HELPER_SEQ` (`I` tinyint(3) UNSIGNED NOT NULL);
      INSERT INTO `HELPER_SEQ` (`I`) VALUES (1),(2),(3),(4),(5),(6);


      Question:



      How can I avoid output weekends days using query1?
      In a such way that the output go back in 6 useful days, in this example starting on '2018-11-21' the output would be ->



      | 2018-11-21 | 
      | 2018-11-20 |
      | 2018-11-19 |
      | 2018-11-16 |
      | 2018-11-15 |
      | 2018-11-14 |









      share|improve this question















      I often use this query1 to go back 6 days on a variable date:



      query1 = SELECT
      DATE_FORMAT((DATE('2018-11-21') - INTERVAL(S.`I` - 1) DAY), '%Y-%m-%d')
      AS VAR
      FROM `HELPER_SEQ`
      AS S WHERE S.`I` <= 6;


      With the help of this auxiliary table with a sequence inserted there.



      CREATE TABLE `HELPER_SEQ` (`I` tinyint(3) UNSIGNED NOT NULL);
      INSERT INTO `HELPER_SEQ` (`I`) VALUES (1),(2),(3),(4),(5),(6);


      Question:



      How can I avoid output weekends days using query1?
      In a such way that the output go back in 6 useful days, in this example starting on '2018-11-21' the output would be ->



      | 2018-11-21 | 
      | 2018-11-20 |
      | 2018-11-19 |
      | 2018-11-16 |
      | 2018-11-15 |
      | 2018-11-14 |






      mysql mysqli






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 22 '18 at 10:13









      Madhur Bhaiya

      19.5k62236




      19.5k62236










      asked Nov 21 '18 at 11:25









      Nelson Bustier

      387




      387
























          1 Answer
          1






          active

          oldest

          votes


















          1














          We can utilize DayName() function to get the name of the weekday corresponding to a Date. We will utilize this function's result to restrict weekends by NOT IN ('Saturday', 'Sunday').



          Also, we will need to increase the number generator range upto 10. Because there is a possibility that we can come across 2 weekends (total 4 days) on either side of 5 weekdays.



          So, we need 2 (first pair of weekend days) + 5 (weekdays) + 2 (second pair of weekend days) + 1 (6th weekday) = 10 dates to consider. An example of this edge case would be when an input date is Sunday.



          We will need to use LIMIT 6 to restrict the result upto 6 days only, in the non-edge cases.



          Schema (MySQL v5.7)



          CREATE TABLE `HELPER_SEQ` (`I` tinyint(3) UNSIGNED NOT NULL);
          INSERT INTO `HELPER_SEQ` (`I`) VALUES
          (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);


          Query



          SELECT
          DATE_FORMAT((DATE('2018-11-21') - INTERVAL(S.`I` - 1) DAY), '%Y-%m-%d')
          AS VAR
          FROM `HELPER_SEQ` AS S
          WHERE S.`I` <= 10
          AND DAYNAME(DATE_FORMAT((DATE('2018-11-21') - INTERVAL(S.`I` - 1) DAY), '%Y-%m-%d')) NOT IN ('SATURDAY', 'SUNDAY')
          ORDER BY VAR DESC
          LIMIT 6;


          Result



          | VAR        |
          | ---------- |
          | 2018-11-21 |
          | 2018-11-20 |
          | 2018-11-19 |
          | 2018-11-16 |
          | 2018-11-15 |
          | 2018-11-14 |


          View on DB Fiddle





          Edge Case Demo - Input date: 25 Nov 2018 (Sunday)



          CREATE TABLE `HELPER_SEQ` (`I` tinyint(3) UNSIGNED NOT NULL);
          INSERT INTO `HELPER_SEQ` (`I`) VALUES
          (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);


          Query #2



          SELECT
          DATE_FORMAT((DATE('2018-11-25') - INTERVAL(S.`I` - 1) DAY), '%Y-%m-%d')
          AS VAR
          FROM `HELPER_SEQ` AS S
          WHERE S.`I` <= 10
          AND DAYNAME(DATE_FORMAT((DATE('2018-11-25') - INTERVAL(S.`I` - 1) DAY), '%Y-%m-%d')) NOT IN ('SATURDAY', 'SUNDAY')
          ORDER BY VAR DESC
          LIMIT 6;


          Result



          | VAR        |
          | ---------- |
          | 2018-11-23 |
          | 2018-11-22 |
          | 2018-11-21 |
          | 2018-11-20 |
          | 2018-11-19 |
          | 2018-11-16 |


          View on DB Fiddle






          share|improve this answer























          • Madhur Bhaiya, But my idea is that it would continue for six days. In this case starting on 2018-11-21 the intended output would be: | 2018-11-21 | 2018-11-20 | 2018-11-19 | 2018-11-16 | 2018-11-15 | 2018-11- 14 |; How is this possible ?
            – Nelson Bustier
            Nov 22 '18 at 10:02










          • @NelsonBustier please specify this in the question. I will update answer accordingly.
            – Madhur Bhaiya
            Nov 22 '18 at 10:03










          • Madhur Bhaiya, Already done . TY
            – Nelson Bustier
            Nov 22 '18 at 10:12










          • @NelsonBustier you will need 6 days only ? not more than that ?
            – Madhur Bhaiya
            Nov 22 '18 at 10:12






          • 1




            Madhur Bhaiya, Done! Perfect answer. It works. TY
            – Nelson Bustier
            Nov 22 '18 at 10:20











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53411079%2fthrowback-in-dates-without-weekends%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          We can utilize DayName() function to get the name of the weekday corresponding to a Date. We will utilize this function's result to restrict weekends by NOT IN ('Saturday', 'Sunday').



          Also, we will need to increase the number generator range upto 10. Because there is a possibility that we can come across 2 weekends (total 4 days) on either side of 5 weekdays.



          So, we need 2 (first pair of weekend days) + 5 (weekdays) + 2 (second pair of weekend days) + 1 (6th weekday) = 10 dates to consider. An example of this edge case would be when an input date is Sunday.



          We will need to use LIMIT 6 to restrict the result upto 6 days only, in the non-edge cases.



          Schema (MySQL v5.7)



          CREATE TABLE `HELPER_SEQ` (`I` tinyint(3) UNSIGNED NOT NULL);
          INSERT INTO `HELPER_SEQ` (`I`) VALUES
          (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);


          Query



          SELECT
          DATE_FORMAT((DATE('2018-11-21') - INTERVAL(S.`I` - 1) DAY), '%Y-%m-%d')
          AS VAR
          FROM `HELPER_SEQ` AS S
          WHERE S.`I` <= 10
          AND DAYNAME(DATE_FORMAT((DATE('2018-11-21') - INTERVAL(S.`I` - 1) DAY), '%Y-%m-%d')) NOT IN ('SATURDAY', 'SUNDAY')
          ORDER BY VAR DESC
          LIMIT 6;


          Result



          | VAR        |
          | ---------- |
          | 2018-11-21 |
          | 2018-11-20 |
          | 2018-11-19 |
          | 2018-11-16 |
          | 2018-11-15 |
          | 2018-11-14 |


          View on DB Fiddle





          Edge Case Demo - Input date: 25 Nov 2018 (Sunday)



          CREATE TABLE `HELPER_SEQ` (`I` tinyint(3) UNSIGNED NOT NULL);
          INSERT INTO `HELPER_SEQ` (`I`) VALUES
          (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);


          Query #2



          SELECT
          DATE_FORMAT((DATE('2018-11-25') - INTERVAL(S.`I` - 1) DAY), '%Y-%m-%d')
          AS VAR
          FROM `HELPER_SEQ` AS S
          WHERE S.`I` <= 10
          AND DAYNAME(DATE_FORMAT((DATE('2018-11-25') - INTERVAL(S.`I` - 1) DAY), '%Y-%m-%d')) NOT IN ('SATURDAY', 'SUNDAY')
          ORDER BY VAR DESC
          LIMIT 6;


          Result



          | VAR        |
          | ---------- |
          | 2018-11-23 |
          | 2018-11-22 |
          | 2018-11-21 |
          | 2018-11-20 |
          | 2018-11-19 |
          | 2018-11-16 |


          View on DB Fiddle






          share|improve this answer























          • Madhur Bhaiya, But my idea is that it would continue for six days. In this case starting on 2018-11-21 the intended output would be: | 2018-11-21 | 2018-11-20 | 2018-11-19 | 2018-11-16 | 2018-11-15 | 2018-11- 14 |; How is this possible ?
            – Nelson Bustier
            Nov 22 '18 at 10:02










          • @NelsonBustier please specify this in the question. I will update answer accordingly.
            – Madhur Bhaiya
            Nov 22 '18 at 10:03










          • Madhur Bhaiya, Already done . TY
            – Nelson Bustier
            Nov 22 '18 at 10:12










          • @NelsonBustier you will need 6 days only ? not more than that ?
            – Madhur Bhaiya
            Nov 22 '18 at 10:12






          • 1




            Madhur Bhaiya, Done! Perfect answer. It works. TY
            – Nelson Bustier
            Nov 22 '18 at 10:20
















          1














          We can utilize DayName() function to get the name of the weekday corresponding to a Date. We will utilize this function's result to restrict weekends by NOT IN ('Saturday', 'Sunday').



          Also, we will need to increase the number generator range upto 10. Because there is a possibility that we can come across 2 weekends (total 4 days) on either side of 5 weekdays.



          So, we need 2 (first pair of weekend days) + 5 (weekdays) + 2 (second pair of weekend days) + 1 (6th weekday) = 10 dates to consider. An example of this edge case would be when an input date is Sunday.



          We will need to use LIMIT 6 to restrict the result upto 6 days only, in the non-edge cases.



          Schema (MySQL v5.7)



          CREATE TABLE `HELPER_SEQ` (`I` tinyint(3) UNSIGNED NOT NULL);
          INSERT INTO `HELPER_SEQ` (`I`) VALUES
          (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);


          Query



          SELECT
          DATE_FORMAT((DATE('2018-11-21') - INTERVAL(S.`I` - 1) DAY), '%Y-%m-%d')
          AS VAR
          FROM `HELPER_SEQ` AS S
          WHERE S.`I` <= 10
          AND DAYNAME(DATE_FORMAT((DATE('2018-11-21') - INTERVAL(S.`I` - 1) DAY), '%Y-%m-%d')) NOT IN ('SATURDAY', 'SUNDAY')
          ORDER BY VAR DESC
          LIMIT 6;


          Result



          | VAR        |
          | ---------- |
          | 2018-11-21 |
          | 2018-11-20 |
          | 2018-11-19 |
          | 2018-11-16 |
          | 2018-11-15 |
          | 2018-11-14 |


          View on DB Fiddle





          Edge Case Demo - Input date: 25 Nov 2018 (Sunday)



          CREATE TABLE `HELPER_SEQ` (`I` tinyint(3) UNSIGNED NOT NULL);
          INSERT INTO `HELPER_SEQ` (`I`) VALUES
          (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);


          Query #2



          SELECT
          DATE_FORMAT((DATE('2018-11-25') - INTERVAL(S.`I` - 1) DAY), '%Y-%m-%d')
          AS VAR
          FROM `HELPER_SEQ` AS S
          WHERE S.`I` <= 10
          AND DAYNAME(DATE_FORMAT((DATE('2018-11-25') - INTERVAL(S.`I` - 1) DAY), '%Y-%m-%d')) NOT IN ('SATURDAY', 'SUNDAY')
          ORDER BY VAR DESC
          LIMIT 6;


          Result



          | VAR        |
          | ---------- |
          | 2018-11-23 |
          | 2018-11-22 |
          | 2018-11-21 |
          | 2018-11-20 |
          | 2018-11-19 |
          | 2018-11-16 |


          View on DB Fiddle






          share|improve this answer























          • Madhur Bhaiya, But my idea is that it would continue for six days. In this case starting on 2018-11-21 the intended output would be: | 2018-11-21 | 2018-11-20 | 2018-11-19 | 2018-11-16 | 2018-11-15 | 2018-11- 14 |; How is this possible ?
            – Nelson Bustier
            Nov 22 '18 at 10:02










          • @NelsonBustier please specify this in the question. I will update answer accordingly.
            – Madhur Bhaiya
            Nov 22 '18 at 10:03










          • Madhur Bhaiya, Already done . TY
            – Nelson Bustier
            Nov 22 '18 at 10:12










          • @NelsonBustier you will need 6 days only ? not more than that ?
            – Madhur Bhaiya
            Nov 22 '18 at 10:12






          • 1




            Madhur Bhaiya, Done! Perfect answer. It works. TY
            – Nelson Bustier
            Nov 22 '18 at 10:20














          1












          1








          1






          We can utilize DayName() function to get the name of the weekday corresponding to a Date. We will utilize this function's result to restrict weekends by NOT IN ('Saturday', 'Sunday').



          Also, we will need to increase the number generator range upto 10. Because there is a possibility that we can come across 2 weekends (total 4 days) on either side of 5 weekdays.



          So, we need 2 (first pair of weekend days) + 5 (weekdays) + 2 (second pair of weekend days) + 1 (6th weekday) = 10 dates to consider. An example of this edge case would be when an input date is Sunday.



          We will need to use LIMIT 6 to restrict the result upto 6 days only, in the non-edge cases.



          Schema (MySQL v5.7)



          CREATE TABLE `HELPER_SEQ` (`I` tinyint(3) UNSIGNED NOT NULL);
          INSERT INTO `HELPER_SEQ` (`I`) VALUES
          (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);


          Query



          SELECT
          DATE_FORMAT((DATE('2018-11-21') - INTERVAL(S.`I` - 1) DAY), '%Y-%m-%d')
          AS VAR
          FROM `HELPER_SEQ` AS S
          WHERE S.`I` <= 10
          AND DAYNAME(DATE_FORMAT((DATE('2018-11-21') - INTERVAL(S.`I` - 1) DAY), '%Y-%m-%d')) NOT IN ('SATURDAY', 'SUNDAY')
          ORDER BY VAR DESC
          LIMIT 6;


          Result



          | VAR        |
          | ---------- |
          | 2018-11-21 |
          | 2018-11-20 |
          | 2018-11-19 |
          | 2018-11-16 |
          | 2018-11-15 |
          | 2018-11-14 |


          View on DB Fiddle





          Edge Case Demo - Input date: 25 Nov 2018 (Sunday)



          CREATE TABLE `HELPER_SEQ` (`I` tinyint(3) UNSIGNED NOT NULL);
          INSERT INTO `HELPER_SEQ` (`I`) VALUES
          (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);


          Query #2



          SELECT
          DATE_FORMAT((DATE('2018-11-25') - INTERVAL(S.`I` - 1) DAY), '%Y-%m-%d')
          AS VAR
          FROM `HELPER_SEQ` AS S
          WHERE S.`I` <= 10
          AND DAYNAME(DATE_FORMAT((DATE('2018-11-25') - INTERVAL(S.`I` - 1) DAY), '%Y-%m-%d')) NOT IN ('SATURDAY', 'SUNDAY')
          ORDER BY VAR DESC
          LIMIT 6;


          Result



          | VAR        |
          | ---------- |
          | 2018-11-23 |
          | 2018-11-22 |
          | 2018-11-21 |
          | 2018-11-20 |
          | 2018-11-19 |
          | 2018-11-16 |


          View on DB Fiddle






          share|improve this answer














          We can utilize DayName() function to get the name of the weekday corresponding to a Date. We will utilize this function's result to restrict weekends by NOT IN ('Saturday', 'Sunday').



          Also, we will need to increase the number generator range upto 10. Because there is a possibility that we can come across 2 weekends (total 4 days) on either side of 5 weekdays.



          So, we need 2 (first pair of weekend days) + 5 (weekdays) + 2 (second pair of weekend days) + 1 (6th weekday) = 10 dates to consider. An example of this edge case would be when an input date is Sunday.



          We will need to use LIMIT 6 to restrict the result upto 6 days only, in the non-edge cases.



          Schema (MySQL v5.7)



          CREATE TABLE `HELPER_SEQ` (`I` tinyint(3) UNSIGNED NOT NULL);
          INSERT INTO `HELPER_SEQ` (`I`) VALUES
          (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);


          Query



          SELECT
          DATE_FORMAT((DATE('2018-11-21') - INTERVAL(S.`I` - 1) DAY), '%Y-%m-%d')
          AS VAR
          FROM `HELPER_SEQ` AS S
          WHERE S.`I` <= 10
          AND DAYNAME(DATE_FORMAT((DATE('2018-11-21') - INTERVAL(S.`I` - 1) DAY), '%Y-%m-%d')) NOT IN ('SATURDAY', 'SUNDAY')
          ORDER BY VAR DESC
          LIMIT 6;


          Result



          | VAR        |
          | ---------- |
          | 2018-11-21 |
          | 2018-11-20 |
          | 2018-11-19 |
          | 2018-11-16 |
          | 2018-11-15 |
          | 2018-11-14 |


          View on DB Fiddle





          Edge Case Demo - Input date: 25 Nov 2018 (Sunday)



          CREATE TABLE `HELPER_SEQ` (`I` tinyint(3) UNSIGNED NOT NULL);
          INSERT INTO `HELPER_SEQ` (`I`) VALUES
          (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);


          Query #2



          SELECT
          DATE_FORMAT((DATE('2018-11-25') - INTERVAL(S.`I` - 1) DAY), '%Y-%m-%d')
          AS VAR
          FROM `HELPER_SEQ` AS S
          WHERE S.`I` <= 10
          AND DAYNAME(DATE_FORMAT((DATE('2018-11-25') - INTERVAL(S.`I` - 1) DAY), '%Y-%m-%d')) NOT IN ('SATURDAY', 'SUNDAY')
          ORDER BY VAR DESC
          LIMIT 6;


          Result



          | VAR        |
          | ---------- |
          | 2018-11-23 |
          | 2018-11-22 |
          | 2018-11-21 |
          | 2018-11-20 |
          | 2018-11-19 |
          | 2018-11-16 |


          View on DB Fiddle







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 22 '18 at 10:38

























          answered Nov 21 '18 at 18:03









          Madhur Bhaiya

          19.5k62236




          19.5k62236












          • Madhur Bhaiya, But my idea is that it would continue for six days. In this case starting on 2018-11-21 the intended output would be: | 2018-11-21 | 2018-11-20 | 2018-11-19 | 2018-11-16 | 2018-11-15 | 2018-11- 14 |; How is this possible ?
            – Nelson Bustier
            Nov 22 '18 at 10:02










          • @NelsonBustier please specify this in the question. I will update answer accordingly.
            – Madhur Bhaiya
            Nov 22 '18 at 10:03










          • Madhur Bhaiya, Already done . TY
            – Nelson Bustier
            Nov 22 '18 at 10:12










          • @NelsonBustier you will need 6 days only ? not more than that ?
            – Madhur Bhaiya
            Nov 22 '18 at 10:12






          • 1




            Madhur Bhaiya, Done! Perfect answer. It works. TY
            – Nelson Bustier
            Nov 22 '18 at 10:20


















          • Madhur Bhaiya, But my idea is that it would continue for six days. In this case starting on 2018-11-21 the intended output would be: | 2018-11-21 | 2018-11-20 | 2018-11-19 | 2018-11-16 | 2018-11-15 | 2018-11- 14 |; How is this possible ?
            – Nelson Bustier
            Nov 22 '18 at 10:02










          • @NelsonBustier please specify this in the question. I will update answer accordingly.
            – Madhur Bhaiya
            Nov 22 '18 at 10:03










          • Madhur Bhaiya, Already done . TY
            – Nelson Bustier
            Nov 22 '18 at 10:12










          • @NelsonBustier you will need 6 days only ? not more than that ?
            – Madhur Bhaiya
            Nov 22 '18 at 10:12






          • 1




            Madhur Bhaiya, Done! Perfect answer. It works. TY
            – Nelson Bustier
            Nov 22 '18 at 10:20
















          Madhur Bhaiya, But my idea is that it would continue for six days. In this case starting on 2018-11-21 the intended output would be: | 2018-11-21 | 2018-11-20 | 2018-11-19 | 2018-11-16 | 2018-11-15 | 2018-11- 14 |; How is this possible ?
          – Nelson Bustier
          Nov 22 '18 at 10:02




          Madhur Bhaiya, But my idea is that it would continue for six days. In this case starting on 2018-11-21 the intended output would be: | 2018-11-21 | 2018-11-20 | 2018-11-19 | 2018-11-16 | 2018-11-15 | 2018-11- 14 |; How is this possible ?
          – Nelson Bustier
          Nov 22 '18 at 10:02












          @NelsonBustier please specify this in the question. I will update answer accordingly.
          – Madhur Bhaiya
          Nov 22 '18 at 10:03




          @NelsonBustier please specify this in the question. I will update answer accordingly.
          – Madhur Bhaiya
          Nov 22 '18 at 10:03












          Madhur Bhaiya, Already done . TY
          – Nelson Bustier
          Nov 22 '18 at 10:12




          Madhur Bhaiya, Already done . TY
          – Nelson Bustier
          Nov 22 '18 at 10:12












          @NelsonBustier you will need 6 days only ? not more than that ?
          – Madhur Bhaiya
          Nov 22 '18 at 10:12




          @NelsonBustier you will need 6 days only ? not more than that ?
          – Madhur Bhaiya
          Nov 22 '18 at 10:12




          1




          1




          Madhur Bhaiya, Done! Perfect answer. It works. TY
          – Nelson Bustier
          Nov 22 '18 at 10:20




          Madhur Bhaiya, Done! Perfect answer. It works. TY
          – Nelson Bustier
          Nov 22 '18 at 10:20


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53411079%2fthrowback-in-dates-without-weekends%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Wiesbaden

          Marschland

          Dieringhausen