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
//You can also use this to asses the age of anything, really. | |
//For example, dynamically display how long your company has been around, when your next appointment is, etc. | |
var birthday = new Date(1998,10,22); //Change to your birthday (year,month,day) | |
//Your age in decimals, with complete precision (1000 milliseconds, 60 seconds, 60 minutes, 24 hours, 365 days) | |
var age = ((new Date() - birthday) / 1000 / 60 / 60 / 24 / 365); | |
var precision = 1000; //However many zeros is how many places (1000 returns 3 places, 1 returns 0 places) | |
//With `precision` set to 1000, you would get something like 16.495, and 1 would just be 16 |