I wanted to know if there’s a javascript library which can convert timestamp (Date java class value) to text.
for example:
- two minutes ago
- 4 hours ago
- 23 Aug 2009
is this kind of library exist? otherwise I’ll implement it by myself of course.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I would suggest you to try momentjs which helps you parse time formats. Take a look at http://momentjs.com/
Heres some sample codes:
moment().format(‘dddd, MMMM Do YYYY, h:mm:ss a’);
moment().format(‘dddd [on the] wo [week of the year]’);
moment().format(“MMM Do ‘YY”); moment().format();
This library is helpful and easy to learn.