Human Readable Unix Timestamp Converter with jQuery - Timestamp Tag

Human Readable Unix Timestamp Converter with jQuery - Timestamp Tag
File Size: 6.83 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Timestamp Tag is a lightweight jQuery plugin for converting UNIX timestamp into human readable date & time with custom formats.

How to use it:

1. Include the jQuery timestamp tag plugin after you've included jQuery library but before the closing body tag.

<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="lib/timestamp-tag.js"></script>

2. Add a UNIX timestamp to your webpage.

<timestamp format="l dS /o/f F Y h:i:s A" 
           title-format="d:m:Y h:i:s">
           1450632633
</timestamp>

3. That's it. The plugin will output:

Wednesday 25th of February 2015 18:58:03 PM

4. Enable 'timeAgo' mode to make the output more human readable.

<timestamp timeago="true" 
           format="l dS /o/f F Y h:i:s A" 
           title-format="d:m:Y h:i:s">
           1450632633
</timestamp>

5. The plugin will output:

8 hours ago

6. Custom dataTime format.

  • d: Day of the month, 2 digits with leading zeros 
  • D: A textual representation of a day, three letters
  • j: Day of the month without leading zeros
  • l: A full textual representation of the day of the week
  • N: ISO-8601 numeric representation of the day of the week 
  • S: English ordinal suffix for the day of the month, 2 characters
  • w: Numeric representation of the day of the week. 0 (for Sunday) through 6 (for Saturday)
  • W: ISO-8601 week number of year, weeks starting on Monday  
  • F: A full textual representation of a month, such as January or March  January through December
  • m: Numeric representation of a month, with leading zeros
  • M: A short textual representation of a month, three letters
  • n: Numeric representation of a month, without leading zeros
  • t: Number of days in the given month 28 through 31
  • Y: A full numeric representation of a year, 4 digits
  • y: A two digit representation of a year 
  • a: Lowercase Ante meridiem and Post meridiem am or pm
  • A: Uppercase Ante meridiem and Post meridiem AM or PM
  • g: 12-hour format of an hour without leading zeros
  • G: 24-hour format of an hour without leading zeros
  • h: 12-hour format of an hour with leading zeros
  • H: 24-hour format of an hour with leading zeros
  • i: Minutes with leading zeros
  • s: Seconds, with leading zeros

This awesome jQuery plugin is developed by Pakipreneurs. For more Advanced Usages, please check the demo page or visit the official website.