Is there an HTTP address returning today's date ?

F

Francesco M.

Hi all,
well this question isn't exclusive about Java only but it I
hope somebody has got an answer for it.
I'd like to read todays's date opening an URLConnection, so
does anybody know if there's a web address that returns todays'
date in any format ?
it's something like a minimal web service, as it's accessed via
HTTP protocol..........

Thanks a lot
Francesco
 
T

Thomas Kellerer

I'd like to read todays's date opening an URLConnection, so
does anybody know if there's a web address that returns todays'
date in any format ?

And which date should that URL return? It can most probably only return the
server's date, which might be different to your local one


And if you are already inside a Java code, why not simply use
java.util.Date today = new java.util.Date();

Thomas
 
T

Thomas Fritsch

Francesco said:
Hi all,
well this question isn't exclusive about Java only but it I
hope somebody has got an answer for it.
I'd like to read todays's date opening an URLConnection, so
does anybody know if there's a web address that returns todays'
date in any format ?
it's something like a minimal web service, as it's accessed via
HTTP protocol..........

Thanks a lot
Francesco

Why not simply calling UrlConnection#getDate on *any* HTTP-URL, which
gives the time when the HTTP server sent the response. See
http://java.sun.com/j2se/1.4.2/docs/api/java/net/URLConnection.html#getDate()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top