Chris Nielsen Code Walk

Coding and Tech How-Tos

Menu

Skip to content
  • Home
  • Table of Contents
  • Subscribe
  • Blog Stats
Search

getTime()

JavaScript: How to calculate the number of days between two dates

July 17, 2018 / Chris Nielsen

The following function takes in two dates and returns the number of days between them: // Calculate the difference of two dates in total days function diffDays(d1, d2) { let numDays = 0; let tv1 = d1.getTime(); // msec since 1970 let tv2 = d2.getTime(); numDays = (tv2 – tv1) / 1000 / 86400; numDays … Continue reading JavaScript: How to calculate the number of days between two dates

Recent Posts

  • How to set up CI/CD
  • AI prompt: How to import Copilot output into WordPress
  • AI prompt: Build a hanging movie kiosk, part 2
  • AI prompt: Build a hanging movie kiosk
  • Vue.js: How to hide a public API key from github
  • JavaScript: How to use the .call( ) method
  • Javascript: How to use ES6 Template Literals
  • Vue.js: How to make an identicon generator
  • Vue.js: How to use Vue CLI to quickly create a project
  • MySQL: How to automatically update timestamp column in phpMyAdmin when a row is edited
  • Tableau: How to recreate a data graphic found on the web
  • MySQL: How to copy database from web host to localhost

Recent Posts

  • How to set up CI/CD
  • AI prompt: How to import Copilot output into WordPress
  • AI prompt: Build a hanging movie kiosk, part 2
  • AI prompt: Build a hanging movie kiosk
  • Vue.js: How to hide a public API key from github

Recent Comments

    Archives

    • November 2026
    • July 2025
    • July 2021
    • May 2021
    • February 2021
    • January 2021
    • December 2020
    • September 2020
    • April 2020
    • March 2020
    • January 2020
    • December 2019
    • November 2019
    • October 2019
    • September 2019
    • July 2019
    • June 2019
    • May 2019
    • November 2018
    • October 2018
    • September 2018
    • August 2018
    • July 2018
    • June 2018
    • May 2018
    • April 2018
    • March 2018
    • February 2018
    • January 2018
    • December 2017
    • November 2017
    • October 2017
    • September 2017
    • August 2017
    • July 2017
    • June 2017

    Categories

    • AI
    • Angular
    • AWS
    • BI Dashboards
    • Data Mining Tools
    • Data Science
    • DevOps
    • Flask
    • Handlebars
    • HTML & CSS
    • JavaScript Language
    • jQuery
    • Kotlin
    • Meteor
    • MySQL
    • Node.js
    • p5.js
    • Pandas
    • Perl Language
    • PHP Language
    • Processing Language
    • Processing.py
    • Python CGI
    • Python Language
    • Python Web Scraping
    • React
    • Ruby on Rails
    • Technologies and Tools
    • Vue.js
    • WordPress

    Meta

    • Log in
    • Entries feed
    • Comments feed
    • WordPress.org

    Search:

    Tag List

    JavaScriptPythonCSSHTMLjQueryWordpressProcessing.pyReact.jsCGIMySQLNode.jsNPMp5.jsPHPKotliniframeSQLcsvJSONaddEventListener()AtomDate()Vue.jsCookiesDataFrameCopilotAIAJAXPandasMeteorMath.round()Math.random()GITLinuxHTML5canvasgulpApachetoISOString()flexboxEnlighterechoUbuntucanvasContextAngularJSpop-upFont AwesomegetElementById()requestsgridng-appng-controllerresponsiveBootstrap 3angular.module()Handlebars.jsPerlMongoDBng-clickRubyJupyter NotebookBuilt-in help functionsclose()slice()Math.max()from()@keyframesnext()toggle()getDate()setDate()filter()httpd.confSpacebarsBlazeJSXternary operatorsort()cmdreadline()open()var_dump()ng-submitng-repeatng-modelng-classgetTime()Number()toFixed()transformtransitionbackface-visibilitytransform-stylevar_export()print_r()gulp-watchinnerHTMLDOMgetmembersinspectglobanimated .gifenumerate()dictionaryList ComprehensionsFlaskdocstringHTML formsEnvironment Variablessample()Math.floor()TkintermousePressed()clientXgetBoundingClientRect()setInterval()rotateX()WEBGLConfusion Matrixzip()insertAdjacentHTML()XMLHttpRequest()imageioASCIIWeb Appalert()RandomDockerChocolateyto_csv()ng-hideng-showPianoCSS3last-childdecode()encode()isascii()BeautifulSoupskewXAWSHTML entityCodepencallbackhttp.createServer()LambdaContinuous DeliveryContinuous IntegrationCI/CDCDCIthiscall()template literalsES6Vue CLIphpMyAdminTableauodHomebrewS3password_hash()append()docx@mediaquerySelector()PyGameval()prop()tabindexkeydownkeyupdatalistLIFOfocus()autofocusonfocuspop()align-selfcolumn-countpassword_verify()grid-areacsv.writer()column-gapcsv.reader()try/exceptgrid-template-areas

    Archive

    • November 2026 (1)
    • July 2025 (3)
    • July 2021 (1)
    • May 2021 (1)
    • February 2021 (1)
    • January 2021 (1)
    • December 2020 (1)
    • September 2020 (1)
    • April 2020 (1)
    • March 2020 (1)
    • January 2020 (6)
    • December 2019 (2)
    • November 2019 (1)
    • October 2019 (1)
    • September 2019 (3)
    • July 2019 (1)
    • June 2019 (6)
    • May 2019 (2)
    • November 2018 (6)
    • October 2018 (2)
    • September 2018 (1)
    • August 2018 (7)
    • July 2018 (13)
    • June 2018 (4)
    • May 2018 (11)
    • April 2018 (12)
    • March 2018 (12)
    • February 2018 (12)
    • January 2018 (12)
    • December 2017 (12)
    • November 2017 (10)
    • October 2017 (10)
    • September 2017 (14)
    • August 2017 (9)
    • July 2017 (1)
    • June 2017 (3)

    Categories

    • AI (3)
    • AWS (1)
    • BI Dashboards (1)
    • Data Science (1)
    • DevOps (1)
    • Flask (1)
    • HTML & CSS (19)
    • JavaScript Language (68)
      • Angular (2)
      • Handlebars (2)
      • jQuery (10)
      • Meteor (3)
      • Node.js (4)
      • React (8)
      • Vue.js (4)
    • Kotlin (6)
    • MySQL (4)
    • Pandas (3)
    • Perl Language (2)
    • PHP Language (6)
    • Processing Language (13)
      • p5.js (7)
      • Processing.py (6)
    • Python Language (30)
      • Data Mining Tools (2)
      • Python CGI (7)
      • Python Web Scraping (2)
    • Ruby on Rails (2)
    • Technologies and Tools (12)
    • WordPress (12)
    Powered by WordPress | All content by Chris Nielsen. © 2017