How can i get all this builds numbers between particular date using python Jenkins API?












2















For example, i have bunch of builds between 22 and 23. How can i get all this builds numbers between particular date using python Jenkins API?



enter image description here










share|improve this question



























    2















    For example, i have bunch of builds between 22 and 23. How can i get all this builds numbers between particular date using python Jenkins API?



    enter image description here










    share|improve this question

























      2












      2








      2








      For example, i have bunch of builds between 22 and 23. How can i get all this builds numbers between particular date using python Jenkins API?



      enter image description here










      share|improve this question














      For example, i have bunch of builds between 22 and 23. How can i get all this builds numbers between particular date using python Jenkins API?



      enter image description here







      python jenkins jenkins-api






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 23 '18 at 5:22









      Alex NikitinAlex Nikitin

      455




      455
























          2 Answers
          2






          active

          oldest

          votes


















          1














          import jenkins
          from datetime import datetime

          jenkins_url=''
          username=''
          password=''
          job_name=''

          # Fill up your dates in below fields.
          startDate = int(datetime(2018, 10, 20).strftime('%s'))
          endDate = int(datetime(2018, 11, 25).strftime('%s'))



          server = jenkins.Jenkins(jenkins_url,username,password)
          job_info=server.get_job_info(job_name)

          #get the number of finished builds of the job
          total_builds=job_info['lastBuild']['number']


          for build_number in range(1, total_builds):
          # get build info for every build number.
          build_info = server.get_build_info(job_name, build_number)
          timestamp=build_info['timestamp']
          timestamp=timestamp/1000 # The timestamp returned by Jenkins api is in miliseconds
          build_date=datetime.utcfromtimestamp(timestamp).strftime('%Y-%m-%d %H:%M:%S')
          if (timestamp > startDate) & (timestamp < endDate):
          print 'Build Time: '+str(build_date)


          It worked for me. I hope it does for you as well.
          Thanks :)






          share|improve this answer































            1














            You could do it like so by using Jenkins JSON REST API and python request library:



            import requests
            from datetime import datetime

            # Provide following data:
            jenkins_url = "YOUR_JENKINS_URL"
            username = "USERNAME"
            password = "PASSWORD"
            job_name = "JOBNAME"
            stop_date = datetime.strptime("23.11.2018 0:30", "%d.%m.%Y %H:%M")
            start_date = datetime.strptime("22.11.2018 17:30", "%d.%m.%Y %H:%M")

            # Downloading all builds data in one request
            request_url = "{0:s}/job/{1:s}/api/json{2:s}".format(
            jenkins_url,
            job_name,
            "?tree=builds[fullDisplayName,id,number,timestamp]"
            )

            response = requests.get(request_url, auth=(username, password)).json()
            builds =

            for build in response["builds"]:
            # Convert build timestamp to datetime
            build_date = datetime.utcfromtimestamp(build["timestamp"]/1000)
            # Compare build datetime with provided dates range
            if build_date > start_date and build_date < stop_date:
            # Do stuff with builds which fits dates range
            builds.append(build)

            print(builds)


            Above script works both with python 2.7 and 3.x. Now a little explanation:



            First download all builds data by using JSON API using requests library (You may need this in order script to work. To install type: pip install requests) and load response as JSON. Then for each build convert its timestamp to date time and compare with start and stop dates. Please note its important to divide timestamp by 1000 to get seconds not milliseconds (otherwise date conversion from timestamp will raise a ValueError).



            Example output:



            $ python test.py 
            [{u'timestamp': 1541875585881, u'_class': u'hudson.model.FreeStyleBuild', u'number': 21, u'fullDisplayName': u'Dummy #21', u'id': u'21'}, {u'timestamp': 1541875564250, u'_class': u'hudson.model.FreeStyleBuild', u'number': 20, u'fullDisplayName': u'Dummy #20', u'id': u'20'}, {u'timestamp': 1541875506564, u'_class': u'hudson.model.FreeStyleBuild', u'number': 19, u'fullDisplayName': u'Dummy #19', u'id': u'19'}, {u'timestamp': 1541875472100, u'_class': u'hudson.model.FreeStyleBuild', u'number': 18, u'fullDisplayName': u'Dummy #18', u'id': u'18'}]
            $ python3 test.py
            [{'_class': 'hudson.model.FreeStyleBuild', 'fullDisplayName': 'Dummy #21', 'id': '21', 'number': 21, 'timestamp': 1541875585881}, {'_class': 'hudson.model.FreeStyleBuild', 'fullDisplayName': 'Dummy #20', 'id': '20', 'number': 20, 'timestamp': 1541875564250}, {'_class': 'hudson.model.FreeStyleBuild', 'fullDisplayName': 'Dummy #19', 'id': '19', 'number': 19, 'timestamp': 1541875506564}, {'_class': 'hudson.model.FreeStyleBuild', 'fullDisplayName': 'Dummy #18', 'id': '18', 'number': 18, 'timestamp': 1541875472100}]


            On the other hand, if you want to provide start and stop dates in a different format then remember you'll need to adjust format parameter it in strptime() function.
            Python datetime directives.



            Few examples:



            datetime.strptime("23.11.2018", "%d.%m.%Y")
            datetime.strptime("2018.11.23", "%Y.%m.%d")
            datetime.strptime("Jun 1 2005 1:33PM", "%b %d %Y %I:%M%p")





            share|improve this answer























              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%2f53441011%2fhow-can-i-get-all-this-builds-numbers-between-particular-date-using-python-jenki%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              import jenkins
              from datetime import datetime

              jenkins_url=''
              username=''
              password=''
              job_name=''

              # Fill up your dates in below fields.
              startDate = int(datetime(2018, 10, 20).strftime('%s'))
              endDate = int(datetime(2018, 11, 25).strftime('%s'))



              server = jenkins.Jenkins(jenkins_url,username,password)
              job_info=server.get_job_info(job_name)

              #get the number of finished builds of the job
              total_builds=job_info['lastBuild']['number']


              for build_number in range(1, total_builds):
              # get build info for every build number.
              build_info = server.get_build_info(job_name, build_number)
              timestamp=build_info['timestamp']
              timestamp=timestamp/1000 # The timestamp returned by Jenkins api is in miliseconds
              build_date=datetime.utcfromtimestamp(timestamp).strftime('%Y-%m-%d %H:%M:%S')
              if (timestamp > startDate) & (timestamp < endDate):
              print 'Build Time: '+str(build_date)


              It worked for me. I hope it does for you as well.
              Thanks :)






              share|improve this answer




























                1














                import jenkins
                from datetime import datetime

                jenkins_url=''
                username=''
                password=''
                job_name=''

                # Fill up your dates in below fields.
                startDate = int(datetime(2018, 10, 20).strftime('%s'))
                endDate = int(datetime(2018, 11, 25).strftime('%s'))



                server = jenkins.Jenkins(jenkins_url,username,password)
                job_info=server.get_job_info(job_name)

                #get the number of finished builds of the job
                total_builds=job_info['lastBuild']['number']


                for build_number in range(1, total_builds):
                # get build info for every build number.
                build_info = server.get_build_info(job_name, build_number)
                timestamp=build_info['timestamp']
                timestamp=timestamp/1000 # The timestamp returned by Jenkins api is in miliseconds
                build_date=datetime.utcfromtimestamp(timestamp).strftime('%Y-%m-%d %H:%M:%S')
                if (timestamp > startDate) & (timestamp < endDate):
                print 'Build Time: '+str(build_date)


                It worked for me. I hope it does for you as well.
                Thanks :)






                share|improve this answer


























                  1












                  1








                  1







                  import jenkins
                  from datetime import datetime

                  jenkins_url=''
                  username=''
                  password=''
                  job_name=''

                  # Fill up your dates in below fields.
                  startDate = int(datetime(2018, 10, 20).strftime('%s'))
                  endDate = int(datetime(2018, 11, 25).strftime('%s'))



                  server = jenkins.Jenkins(jenkins_url,username,password)
                  job_info=server.get_job_info(job_name)

                  #get the number of finished builds of the job
                  total_builds=job_info['lastBuild']['number']


                  for build_number in range(1, total_builds):
                  # get build info for every build number.
                  build_info = server.get_build_info(job_name, build_number)
                  timestamp=build_info['timestamp']
                  timestamp=timestamp/1000 # The timestamp returned by Jenkins api is in miliseconds
                  build_date=datetime.utcfromtimestamp(timestamp).strftime('%Y-%m-%d %H:%M:%S')
                  if (timestamp > startDate) & (timestamp < endDate):
                  print 'Build Time: '+str(build_date)


                  It worked for me. I hope it does for you as well.
                  Thanks :)






                  share|improve this answer













                  import jenkins
                  from datetime import datetime

                  jenkins_url=''
                  username=''
                  password=''
                  job_name=''

                  # Fill up your dates in below fields.
                  startDate = int(datetime(2018, 10, 20).strftime('%s'))
                  endDate = int(datetime(2018, 11, 25).strftime('%s'))



                  server = jenkins.Jenkins(jenkins_url,username,password)
                  job_info=server.get_job_info(job_name)

                  #get the number of finished builds of the job
                  total_builds=job_info['lastBuild']['number']


                  for build_number in range(1, total_builds):
                  # get build info for every build number.
                  build_info = server.get_build_info(job_name, build_number)
                  timestamp=build_info['timestamp']
                  timestamp=timestamp/1000 # The timestamp returned by Jenkins api is in miliseconds
                  build_date=datetime.utcfromtimestamp(timestamp).strftime('%Y-%m-%d %H:%M:%S')
                  if (timestamp > startDate) & (timestamp < endDate):
                  print 'Build Time: '+str(build_date)


                  It worked for me. I hope it does for you as well.
                  Thanks :)







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 23 '18 at 14:22









                  ameydevameydev

                  564




                  564

























                      1














                      You could do it like so by using Jenkins JSON REST API and python request library:



                      import requests
                      from datetime import datetime

                      # Provide following data:
                      jenkins_url = "YOUR_JENKINS_URL"
                      username = "USERNAME"
                      password = "PASSWORD"
                      job_name = "JOBNAME"
                      stop_date = datetime.strptime("23.11.2018 0:30", "%d.%m.%Y %H:%M")
                      start_date = datetime.strptime("22.11.2018 17:30", "%d.%m.%Y %H:%M")

                      # Downloading all builds data in one request
                      request_url = "{0:s}/job/{1:s}/api/json{2:s}".format(
                      jenkins_url,
                      job_name,
                      "?tree=builds[fullDisplayName,id,number,timestamp]"
                      )

                      response = requests.get(request_url, auth=(username, password)).json()
                      builds =

                      for build in response["builds"]:
                      # Convert build timestamp to datetime
                      build_date = datetime.utcfromtimestamp(build["timestamp"]/1000)
                      # Compare build datetime with provided dates range
                      if build_date > start_date and build_date < stop_date:
                      # Do stuff with builds which fits dates range
                      builds.append(build)

                      print(builds)


                      Above script works both with python 2.7 and 3.x. Now a little explanation:



                      First download all builds data by using JSON API using requests library (You may need this in order script to work. To install type: pip install requests) and load response as JSON. Then for each build convert its timestamp to date time and compare with start and stop dates. Please note its important to divide timestamp by 1000 to get seconds not milliseconds (otherwise date conversion from timestamp will raise a ValueError).



                      Example output:



                      $ python test.py 
                      [{u'timestamp': 1541875585881, u'_class': u'hudson.model.FreeStyleBuild', u'number': 21, u'fullDisplayName': u'Dummy #21', u'id': u'21'}, {u'timestamp': 1541875564250, u'_class': u'hudson.model.FreeStyleBuild', u'number': 20, u'fullDisplayName': u'Dummy #20', u'id': u'20'}, {u'timestamp': 1541875506564, u'_class': u'hudson.model.FreeStyleBuild', u'number': 19, u'fullDisplayName': u'Dummy #19', u'id': u'19'}, {u'timestamp': 1541875472100, u'_class': u'hudson.model.FreeStyleBuild', u'number': 18, u'fullDisplayName': u'Dummy #18', u'id': u'18'}]
                      $ python3 test.py
                      [{'_class': 'hudson.model.FreeStyleBuild', 'fullDisplayName': 'Dummy #21', 'id': '21', 'number': 21, 'timestamp': 1541875585881}, {'_class': 'hudson.model.FreeStyleBuild', 'fullDisplayName': 'Dummy #20', 'id': '20', 'number': 20, 'timestamp': 1541875564250}, {'_class': 'hudson.model.FreeStyleBuild', 'fullDisplayName': 'Dummy #19', 'id': '19', 'number': 19, 'timestamp': 1541875506564}, {'_class': 'hudson.model.FreeStyleBuild', 'fullDisplayName': 'Dummy #18', 'id': '18', 'number': 18, 'timestamp': 1541875472100}]


                      On the other hand, if you want to provide start and stop dates in a different format then remember you'll need to adjust format parameter it in strptime() function.
                      Python datetime directives.



                      Few examples:



                      datetime.strptime("23.11.2018", "%d.%m.%Y")
                      datetime.strptime("2018.11.23", "%Y.%m.%d")
                      datetime.strptime("Jun 1 2005 1:33PM", "%b %d %Y %I:%M%p")





                      share|improve this answer




























                        1














                        You could do it like so by using Jenkins JSON REST API and python request library:



                        import requests
                        from datetime import datetime

                        # Provide following data:
                        jenkins_url = "YOUR_JENKINS_URL"
                        username = "USERNAME"
                        password = "PASSWORD"
                        job_name = "JOBNAME"
                        stop_date = datetime.strptime("23.11.2018 0:30", "%d.%m.%Y %H:%M")
                        start_date = datetime.strptime("22.11.2018 17:30", "%d.%m.%Y %H:%M")

                        # Downloading all builds data in one request
                        request_url = "{0:s}/job/{1:s}/api/json{2:s}".format(
                        jenkins_url,
                        job_name,
                        "?tree=builds[fullDisplayName,id,number,timestamp]"
                        )

                        response = requests.get(request_url, auth=(username, password)).json()
                        builds =

                        for build in response["builds"]:
                        # Convert build timestamp to datetime
                        build_date = datetime.utcfromtimestamp(build["timestamp"]/1000)
                        # Compare build datetime with provided dates range
                        if build_date > start_date and build_date < stop_date:
                        # Do stuff with builds which fits dates range
                        builds.append(build)

                        print(builds)


                        Above script works both with python 2.7 and 3.x. Now a little explanation:



                        First download all builds data by using JSON API using requests library (You may need this in order script to work. To install type: pip install requests) and load response as JSON. Then for each build convert its timestamp to date time and compare with start and stop dates. Please note its important to divide timestamp by 1000 to get seconds not milliseconds (otherwise date conversion from timestamp will raise a ValueError).



                        Example output:



                        $ python test.py 
                        [{u'timestamp': 1541875585881, u'_class': u'hudson.model.FreeStyleBuild', u'number': 21, u'fullDisplayName': u'Dummy #21', u'id': u'21'}, {u'timestamp': 1541875564250, u'_class': u'hudson.model.FreeStyleBuild', u'number': 20, u'fullDisplayName': u'Dummy #20', u'id': u'20'}, {u'timestamp': 1541875506564, u'_class': u'hudson.model.FreeStyleBuild', u'number': 19, u'fullDisplayName': u'Dummy #19', u'id': u'19'}, {u'timestamp': 1541875472100, u'_class': u'hudson.model.FreeStyleBuild', u'number': 18, u'fullDisplayName': u'Dummy #18', u'id': u'18'}]
                        $ python3 test.py
                        [{'_class': 'hudson.model.FreeStyleBuild', 'fullDisplayName': 'Dummy #21', 'id': '21', 'number': 21, 'timestamp': 1541875585881}, {'_class': 'hudson.model.FreeStyleBuild', 'fullDisplayName': 'Dummy #20', 'id': '20', 'number': 20, 'timestamp': 1541875564250}, {'_class': 'hudson.model.FreeStyleBuild', 'fullDisplayName': 'Dummy #19', 'id': '19', 'number': 19, 'timestamp': 1541875506564}, {'_class': 'hudson.model.FreeStyleBuild', 'fullDisplayName': 'Dummy #18', 'id': '18', 'number': 18, 'timestamp': 1541875472100}]


                        On the other hand, if you want to provide start and stop dates in a different format then remember you'll need to adjust format parameter it in strptime() function.
                        Python datetime directives.



                        Few examples:



                        datetime.strptime("23.11.2018", "%d.%m.%Y")
                        datetime.strptime("2018.11.23", "%Y.%m.%d")
                        datetime.strptime("Jun 1 2005 1:33PM", "%b %d %Y %I:%M%p")





                        share|improve this answer


























                          1












                          1








                          1







                          You could do it like so by using Jenkins JSON REST API and python request library:



                          import requests
                          from datetime import datetime

                          # Provide following data:
                          jenkins_url = "YOUR_JENKINS_URL"
                          username = "USERNAME"
                          password = "PASSWORD"
                          job_name = "JOBNAME"
                          stop_date = datetime.strptime("23.11.2018 0:30", "%d.%m.%Y %H:%M")
                          start_date = datetime.strptime("22.11.2018 17:30", "%d.%m.%Y %H:%M")

                          # Downloading all builds data in one request
                          request_url = "{0:s}/job/{1:s}/api/json{2:s}".format(
                          jenkins_url,
                          job_name,
                          "?tree=builds[fullDisplayName,id,number,timestamp]"
                          )

                          response = requests.get(request_url, auth=(username, password)).json()
                          builds =

                          for build in response["builds"]:
                          # Convert build timestamp to datetime
                          build_date = datetime.utcfromtimestamp(build["timestamp"]/1000)
                          # Compare build datetime with provided dates range
                          if build_date > start_date and build_date < stop_date:
                          # Do stuff with builds which fits dates range
                          builds.append(build)

                          print(builds)


                          Above script works both with python 2.7 and 3.x. Now a little explanation:



                          First download all builds data by using JSON API using requests library (You may need this in order script to work. To install type: pip install requests) and load response as JSON. Then for each build convert its timestamp to date time and compare with start and stop dates. Please note its important to divide timestamp by 1000 to get seconds not milliseconds (otherwise date conversion from timestamp will raise a ValueError).



                          Example output:



                          $ python test.py 
                          [{u'timestamp': 1541875585881, u'_class': u'hudson.model.FreeStyleBuild', u'number': 21, u'fullDisplayName': u'Dummy #21', u'id': u'21'}, {u'timestamp': 1541875564250, u'_class': u'hudson.model.FreeStyleBuild', u'number': 20, u'fullDisplayName': u'Dummy #20', u'id': u'20'}, {u'timestamp': 1541875506564, u'_class': u'hudson.model.FreeStyleBuild', u'number': 19, u'fullDisplayName': u'Dummy #19', u'id': u'19'}, {u'timestamp': 1541875472100, u'_class': u'hudson.model.FreeStyleBuild', u'number': 18, u'fullDisplayName': u'Dummy #18', u'id': u'18'}]
                          $ python3 test.py
                          [{'_class': 'hudson.model.FreeStyleBuild', 'fullDisplayName': 'Dummy #21', 'id': '21', 'number': 21, 'timestamp': 1541875585881}, {'_class': 'hudson.model.FreeStyleBuild', 'fullDisplayName': 'Dummy #20', 'id': '20', 'number': 20, 'timestamp': 1541875564250}, {'_class': 'hudson.model.FreeStyleBuild', 'fullDisplayName': 'Dummy #19', 'id': '19', 'number': 19, 'timestamp': 1541875506564}, {'_class': 'hudson.model.FreeStyleBuild', 'fullDisplayName': 'Dummy #18', 'id': '18', 'number': 18, 'timestamp': 1541875472100}]


                          On the other hand, if you want to provide start and stop dates in a different format then remember you'll need to adjust format parameter it in strptime() function.
                          Python datetime directives.



                          Few examples:



                          datetime.strptime("23.11.2018", "%d.%m.%Y")
                          datetime.strptime("2018.11.23", "%Y.%m.%d")
                          datetime.strptime("Jun 1 2005 1:33PM", "%b %d %Y %I:%M%p")





                          share|improve this answer













                          You could do it like so by using Jenkins JSON REST API and python request library:



                          import requests
                          from datetime import datetime

                          # Provide following data:
                          jenkins_url = "YOUR_JENKINS_URL"
                          username = "USERNAME"
                          password = "PASSWORD"
                          job_name = "JOBNAME"
                          stop_date = datetime.strptime("23.11.2018 0:30", "%d.%m.%Y %H:%M")
                          start_date = datetime.strptime("22.11.2018 17:30", "%d.%m.%Y %H:%M")

                          # Downloading all builds data in one request
                          request_url = "{0:s}/job/{1:s}/api/json{2:s}".format(
                          jenkins_url,
                          job_name,
                          "?tree=builds[fullDisplayName,id,number,timestamp]"
                          )

                          response = requests.get(request_url, auth=(username, password)).json()
                          builds =

                          for build in response["builds"]:
                          # Convert build timestamp to datetime
                          build_date = datetime.utcfromtimestamp(build["timestamp"]/1000)
                          # Compare build datetime with provided dates range
                          if build_date > start_date and build_date < stop_date:
                          # Do stuff with builds which fits dates range
                          builds.append(build)

                          print(builds)


                          Above script works both with python 2.7 and 3.x. Now a little explanation:



                          First download all builds data by using JSON API using requests library (You may need this in order script to work. To install type: pip install requests) and load response as JSON. Then for each build convert its timestamp to date time and compare with start and stop dates. Please note its important to divide timestamp by 1000 to get seconds not milliseconds (otherwise date conversion from timestamp will raise a ValueError).



                          Example output:



                          $ python test.py 
                          [{u'timestamp': 1541875585881, u'_class': u'hudson.model.FreeStyleBuild', u'number': 21, u'fullDisplayName': u'Dummy #21', u'id': u'21'}, {u'timestamp': 1541875564250, u'_class': u'hudson.model.FreeStyleBuild', u'number': 20, u'fullDisplayName': u'Dummy #20', u'id': u'20'}, {u'timestamp': 1541875506564, u'_class': u'hudson.model.FreeStyleBuild', u'number': 19, u'fullDisplayName': u'Dummy #19', u'id': u'19'}, {u'timestamp': 1541875472100, u'_class': u'hudson.model.FreeStyleBuild', u'number': 18, u'fullDisplayName': u'Dummy #18', u'id': u'18'}]
                          $ python3 test.py
                          [{'_class': 'hudson.model.FreeStyleBuild', 'fullDisplayName': 'Dummy #21', 'id': '21', 'number': 21, 'timestamp': 1541875585881}, {'_class': 'hudson.model.FreeStyleBuild', 'fullDisplayName': 'Dummy #20', 'id': '20', 'number': 20, 'timestamp': 1541875564250}, {'_class': 'hudson.model.FreeStyleBuild', 'fullDisplayName': 'Dummy #19', 'id': '19', 'number': 19, 'timestamp': 1541875506564}, {'_class': 'hudson.model.FreeStyleBuild', 'fullDisplayName': 'Dummy #18', 'id': '18', 'number': 18, 'timestamp': 1541875472100}]


                          On the other hand, if you want to provide start and stop dates in a different format then remember you'll need to adjust format parameter it in strptime() function.
                          Python datetime directives.



                          Few examples:



                          datetime.strptime("23.11.2018", "%d.%m.%Y")
                          datetime.strptime("2018.11.23", "%Y.%m.%d")
                          datetime.strptime("Jun 1 2005 1:33PM", "%b %d %Y %I:%M%p")






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 26 '18 at 20:35









                          Raoslaw SzamszurRaoslaw Szamszur

                          910515




                          910515






























                              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.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53441011%2fhow-can-i-get-all-this-builds-numbers-between-particular-date-using-python-jenki%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