Sliding Duration with Javascript or JQuery
Can anyone please suggest, from given date how to calculate sliding duration in javascript or jquery...
I need following output..
- Article published 2 seconds back.
- Article publieshed 1 day back.
- Last modified 3 weeks back..
- Last mondified 1 month back...
Thank you very much.
You're looking for a plugin that does relative or friendly dates. I would recommend the timeago jQuery plugin for this.
jquery animate can do many things.please go through the below api
http://api.jquery.com/animate/
you can even use interval
setInterval(function() //
Take the time in seconds, and divide it by the number of seconds in a year, and that's how many years. Subtract that then divide it by the number of seconds in a month, and that's how many months. Subtract that then divide it by the number of seconds in a week... etc.
精彩评论