This time I will share jQuery Plugin and tutorial about Convert UTC Datetime Into Human Readable Format – UTC-time, hope it will help you in programming stack.
The UTC-time jQuery plugin automatically converts ISO formatted UTC time (last 60 days) into a human readable, auto updating string: x days/hours/minutes/seconds ago.
How to use it:
1. Insert the minified version of the jQuery UTC-time plugin after jQuery.
1 |
< script src = "/path/to/cdn/jquery.slim.min.js" ></ script > |
2 |
< script src = "/path/to/dist/jquery-utc-time.min.js" ></ script > |
2. Insert the UTC time into the data-utc-time
attribute.
1 |
< p data-utc-time = "01/15/2020 05:00:00 AM" ></ p > |
3. Initialize the jQuery UTC-time plugin and done.
3 |
hoursAgo: ' Hours Ago' , |
4 |
minutesAgo: ' Minutes Ago' , |
5 |
secondsAgo: ' Seconds Ago' |
4. This will output the human readable time in the p
.
1 |
<p data-utc-time= "01/15/2020 05:00:00 AM" > |
5. If the the number of days you provide is greater than 60 days:
2 |
< p data-utc-time = "11/7/2017 05:00:00 AM" ></ p > |
5 |
< p data-utc-time = "11/7/2017 05:00:00 AM" > |
6. Change the default data
attribute:
7. Customize the date format:
2 |
format: 'yyyy MM dd hh:mm:ss' , |
8. More configurations.
4 |
disableAutoUpdate: false |
Changelog:
2020-05-17
2020-01-22
2020-01-16
2019-08-05
- v1.3.8: Support init once.
2019-06-10
2019-04-26
- v1.3.3: Support new forceInitUTCTime
2019-01-25
2019-01-10
- v1.3.0: support more features.
2018-12-07
2018-12-06
This awesome jQuery plugin is developed by Anduin2017. For more Advanced Usages, please check the demo page or visit the official website.