Skip to content

Instantly share code, notes, and snippets.

View nathansearles's full-sized avatar
✌️

Nathan Searles nathansearles

✌️
View GitHub Profile
@nathansearles
nathansearles / Time Since
Created July 28, 2011 19:46
A function that'll display the time since a date or time using universal time
function timeSince(date) {
var seconds = Math.floor((new Date() - date) / 1000);
var interval = Math.floor(seconds / 31536000);
if (interval > 1) {
return interval + " years";
}
interval = Math.floor(seconds / 2592000);
if (interval > 1) {
return interval + " months";