Last active
July 5, 2023 01:53
-
-
Save edcottrell/baa96bdeead3ff2bd49805cd0bd37822 to your computer and use it in GitHub Desktop.
TextExpander Snippet for Yesterday's Julian Day Number
This file contains 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
// This is useful for Google searches with date limitations. | |
// Based on the calculations at https://stackoverflow.com/a/11760121 | |
Date.prototype.getJulian = function() { | |
return Math.floor((this / 86400000) - (this.getTimezoneOffset() / 1440) + 2440588); | |
} | |
var yesterday = new Date(); //set any date | |
yesterday.setDate(yesterday.getDate() - 1); | |
var julian = yesterday.getJulian(); //get Julian counterpart | |
TextExpander.appendOutput(julian); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment