Created
July 24, 2023 21:14
-
-
Save Davisonpro/2fd46f6d2e08f423f30e74d8582dbb54 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Calculate the time elapsed since a specific date (example: January 1, 2023) | |
const specificDate = new Date('January 1, 2023'); | |
const timeElapsed = currentDateTime - specificDate; | |
const daysElapsed = Math.floor(timeElapsed / (1000 * 60 * 60 * 24)); | |
// Display all date and time information in the span element | |
datetimeDisplayElement.textContent = `Days Elapsed since January 1, 2023: ${daysElapsed}`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment