Skip to content

Instantly share code, notes, and snippets.

@petrov82
Created September 15, 2014 17:55
Show Gist options
  • Save petrov82/da6aedcc6fe8ee33dacc to your computer and use it in GitHub Desktop.
Save petrov82/da6aedcc6fe8ee33dacc to your computer and use it in GitHub Desktop.
JS Stardate
// Stardate script © Phillip L. Sublett
// Phillip.L@Sublett.org
// http://TrekGuide.com
var now = new Date();
var then = new Date("July 15, 1987");
var stardate = now.getTime() - then.getTime();
stardate = stardate / (1000 * 60 * 60 * 24 * 0.036525);
stardate = Math.floor(stardate + 410000);
stardate = stardate / 10
document.write("Today is Stardate " + stardate);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment