有没有提供我可以从中获取当前东部时间的API的时间服务器? [英] Is there a time server that offers an API that i can grab the current eastern time from?
问题描述
好吧,我们的网站上存在一个倒计时,我需要进行一次API调用以获取当前的东部时间.我有这个链接,这是我需要的时间.我可以使用任何方法或任何Web服务使用返回当前时间的jquery get请求.....任何信息都将帮助
Ok we have a countdown on our site and I need to do an api call to get the current eastern time. I have this link which is the time I need. Is there any way or any webservice that i can use a jquery get request that returns the current time.....any info would help
推荐答案
我使用 http://www.timeapi.org/获取当前时间.它可以以多种格式返回日期/时间,并且其免费易用.显然,服务器时间很容易获得,但是有时候这不是一个选择,这就是为什么我多次使用此API的原因.您可以使用他们网站上列出的纯JavaScript方法,但是我选择了jQuery AJAX调用:
I use http://www.timeapi.org/ to get the current time. It can return the date/time in a variety of formats and its free and easy to use. Obviously, the server time is quite easy to get but sometimes that is not an option, which is why I have used this API on a couple occasions. You can use the pure JavaScript method that is listed on their site, but I opted for a jQuery AJAX call :
$.ajax({
type: "GET",
url: 'http://www.timeapi.org/utc/now.json',
dataType: "jsonp",
context: this
}).done(function(data) {
// do stuff
})
.fail(function(){
throw new Error('timeAPI ajax called failed!');
});
这篇关于有没有提供我可以从中获取当前东部时间的API的时间服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!