Convert UNIX Timestamp To Date In JavaScript – TimeElement.js

Category: Date & Time , Javascript | June 7, 2018
Author: hellshltd
Views Total: 728
Official Page: Go to website
Last Update: June 7, 2018
License: MIT

Preview:

Convert UNIX Timestamp To Date In JavaScript – TimeElement.js

Description:

TimeElement.js is a lightweight and simple-to-use JavaScript based UNIX Timestamp converter that converts the UNIX timestamps to human-readable dates.

How to use it:

Download and put the ‘TimeElement.js’ script at the bottom of the webpage but before the closing body tag.

<script src="TimeElement.js"></script>

Initialize the TimeElement.js library.

calculateTimeElements()

Insert a UNIX timestamp into the ‘data-time’ attribute and done.

h2>Year</h2>
<p>The beginning of (UNIX) time: <span data-time="0"></span></p>

<h2>Date</h2>
<p>The time of writing this: <span data-time="1509167749"></span></p>

Disable times.

<h2>Notime</h2>
<p>The time of writing this but the clock broke: <span data-time="1509167749" data-notime=""></span></p>

You Might Be Interested In:


Leave a Reply