0

Well, i'm modifying a board system, and i have this datetime format:

Dayname Daynumber Monthname Year - Time (24 hour format)

Example: Wed 5 Aug 2015 - 17:14

How i can replace this with something like "15 minutes ago", "3 days ago" etc using Jquery?

  • 1
    Use [this](http://momentjs.org) to get exactly what you needed. Am surprised you did not even bother to google that! – t0mm13b Nov 07 '15 at 22:09
  • But how exactly i use this? It does not contain the format posted. Sorry, I am a bit new to jQuery :P – Henrique Irineu Pereira Nov 07 '15 at 22:15
  • jQuery itself is a library written in javascript for DOM manipulation, event handling, animation and ajax, but not a library for date manipulation. So either use pure javascript or a library like momentjs like t0mm13b suggested. [momentjs: Time from now](http://momentjs.com/docs/#/displaying/fromnow/). Beside that it is a duplicate to: [How to format time since xxx e.g. “4 minutes ago” similar to Stack Exchange sites](http://stackoverflow.com/questions/3177836) – t.niese Nov 07 '15 at 22:22
  • I've spend 2 hours trying to get the moment.js to work, but no sucess. How do i do this? That date format (Wed 5 Aug 2015 - 17:14) its on a span tag. How do i use moment.js on this? – Henrique Irineu Pereira Nov 08 '15 at 01:25
  • Then you should show what you have tried to parse that date with moment, the format string you think that should work. – t.niese Nov 09 '15 at 06:10

0 Answers0