Im quite new to the Twitter API so I was hoping to have some guidance regarding my question please see a snippet of my code here : https://jsfiddle.net/amiguel0687/zbakwqt3/.
$(function(){
$('#submit').on('click',function(){
user = $('#user').val();
$.ajax ({
type:"POST",
url: "request.php",
data: { user : user },
success: function(data) {
results = $.parseJSON(data);
$.each(results, function(key, value) {
tweet_interval = value.created_at;
tweet_details = value.text;
tweet_times = new Date(Date.parse(tweet_interval));
tweets = tweet_times+"\n"+tweet_details;
console.log(tweets);
});
}
});
});
});
Now here is the value returned from the API request
Twitter API created_at:
Wed Feb 22 16:11:13 +0000 2017
Using the javascript Date Function() it turns into this
Wed Feb 22 2017 16:20:02 GMT+0800 (China Standard Time)
it automatically gets the timezone where I'm from which would make the result when converted into (Hours,Minutes,Seconds AM/PM) all wrong. Is there a way to have the values just convert into a 12-Hour format and display showing the time it was created like in the Twitter user's timeline. I was hoping for a javascript/jquery solution only but If I need something else entirely then I will have a look at it as well.
UPDATE: According to twitter the value should be 8:20 AM I'm using PCGamer(@pcgamer) as my reference.