Display Timestamps In Minutes In A Human Readable Format - jQuery prettyTime
File Size: | 134 KB |
---|---|
Views Total: | 251 |
Last Update: | |
Publish Date: | |
Official Website: | Go to website |
License: | MIT |
prettyTime is a lightweight and fast jQuery plugin that converts timestamps, durations and time intervals in minutes into human-readable strings.
It provides a simple way to enhance your website's user experience with clear and easily understandable time formats, making it easier for users to grasp the duration of time.
How to use it:
1. Load the jquery.prettyTime.js plugin after jQuery (slim build).
<script src="/path/to/cdn/jquery.slim.min.js"></script> <script src="/path/to/jquery.prettyTime.js"></script>
2. Call the function prettyTime
function.
<span class="prettyTime"> </span>
$(function () { $(".prettyTime").prettyTime(); });
3. You pass in the number of minutes, and prettyTime will return a string like "half an hour" and "twenty-four hours and one minute".
<span class="prettyTime" data-time="30"></span>
// returns "half an hour"
<span class="prettyTime" data-time="1441"></span>
// returns "twenty-four hours and one minute"
Changelog:
2023-07-05
- cleanup
This awesome jQuery plugin is developed by annoyingmouse. For more Advanced Usages, please check the demo page or visit the official website.