Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Generator for natural language timestamps based on unix timestamps
Latest commit cde65ea @dadambickford dadambickford Merge pull request #5 from dadambickford/dadambickford/ticket-4
Issue #4 - putting the proper suffix on 21/22/23 & 31
Failed to load latest commit information.
lib Issue #4 - putting the proper suffix on 21/22/23 & 31
.gitignore removing ds store
index.js Initial
package.json bump version and add contributor data

Fancy Timestamp

Use this to create natural language for your unix timestamps (similar to Facebook's)

Plays well with browserify


Install with NPM and require where needed.

npm install fancy-timestamp
var fancyTimestamp = require('fancy-timestamp');

Fancy Timestamp can accept normal timestamps composed of seconds.

var normalTimestamp = 1342123755; //Using only seconds

var fancyTimestampString = fancyTimestamp(normalTimestamp); // result == "8 minutes ago"

It can also accept timestamps composed of milliseconds such as the ones JavaScript defaults to. To parse millisecond timestamps pass a second parameter of 'true'.

var javascriptTimestamp = (new Date()).getTime(); //Using JavaScript's timestamp composed of milliseconds

fancyTimestampString = fancyTimestamp(javascriptTimestamp, true); // result == "Just now"

Where appropriate, fancy-timestamp will apply the appropriate ending to the natural language text such as 'tomorrow' or 'away' for dates in the future, and 'yesterday' or 'ago' for dates in the past.


MIT license

Something went wrong with that request. Please try again.