I am able to display my tweets in my website using the JavaScript below.
window.onload = function() {
var siteName = 'xyz';
$.getJSON(
'http://search.twitter.com/search.json?callback=?&rpp=20&q=from:' + siteName,
function(data) {
$.each(data, function(i, tweets) {
for (var num = 0, len = tweets.length; num < len; num++) {
if (tweets[num].text !== undefined) {
$('ul#tweets').append('<li><b>' + tweets[num].created_at.substring(0, 16) +
':</b> ' + tweets[num].text + '</li>');
}
}
});
}
);
};
This displays the tweets in US time. Is it possible to show the tweets in NZ time.
I found an easy solution to my problem. Just creating a new Date object (var tim = new Date(tweets[num].created_at)) did the trick. Here is the code which give shows date and time of tweets in my timezone.
I think, the var tim = new Data(tweets[num].created_at) constructor is taking the date from tweets[num].created_at and converting it to local timezone (my machine time) and constructing a new object tim. So the new object tim has local time.
Can anyone please point me to the documentation of the Date(dateString) constructor.