I was able to add a timestamp (the question/problem below)… but now I’m having issues formatting it.
I’d love for it to be “14 minutes ago” or even just the date with the time.
Can anyone help with this? (And if you give me the code, can you tell me where to put it too…)
Thanks!
Here’s what I changed in the code to add the timestamp:
list.append(element.append(paragraph.html(linkify(value.text)).append("<br /><i>@myadorkablelife "+value.created_at+"</i>")));
I’ve been trying to add a timestamp to my twitter feed for a while, nothing seems to be working. (Ideally, it’d be nice to have any appropriate links function like links as well… so bonus points if you can help me with that!)
Here’s what I’ve got on my site:
this.createTwitter=function()
{
$.getJSON('http://twitter.com/statuses/user_timeline.json?screen_name='+$this.twitterName+'&count='+$this.twitterEntryCount+'&callback=?',function(data)
{
if(data.length)
{
var list=$(document.createElement('ul'));
$(data).each(function(index,value)
{
var element=$(document.createElement('li'));
var paragraph=$(document.createElement('p'));
list.append(element.append(paragraph.html(linkify(value.text))));
});
$('#latest-tweets').append(list);
list.bxSlider(
{
auto:true,
pause:5000,
nextText:null,
prevText:null,
mode:'vertical',
displaySlideQty:1
});
list.find('a').attr('target','_blank');
}
});
};
If you need to see the site to view the source better, let me know. jQuery is not my thing, but normally I can search and find what I need.
Each Tweet has a “created_at” attribute which is human readable:
In your case, just call
To get the value of the timestamp.
If you want to get the time (for use in calculations) use
JavaScript should be able to recognise and parse that string.