Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Timeago + Localtime combined

I'm trying to combine timeago with datejs (with help of this to get format for local time)

for timeago I use the following:

jQuery(document).ready(function() {
  jQuery("abbr.timeago").timeago();
});

For the localtime i use this:

jQuery(document).ready(function() {
    $('.UTCTimestamp').localTimeFromUTC('MM/dd/yyyy hh:mm:ss');
});

How do I combine those two together? Right now I'm only able to use one at the time like this:

For Timeago:

<span class='UTCTimestamp'>2011-09-09 10:10:10</span>

and for localtime;

<abbr class='timeago' title='2011-09-09 10:10:10'>2011-09-09 10:10:10</abbr>
like image 682
Detlev Kemps Avatar asked Oct 11 '22 00:10

Detlev Kemps


1 Answers

don't add any javascript code or jquery code except this;

$('.timeago').timeago();

and then add 'Z' (or including T). for more information go to this link

<abbr class='timeago' title='2011-09-09 10:10:10Z'></abbr>

http://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations

like image 117
GAURAV MAHALE Avatar answered Oct 14 '22 03:10

GAURAV MAHALE