Switch
Switch

Reputation: 15443

JSP client's date and time

Is there any specific way of getting client's date and time without using any Javascript at all,but only using a JSP, As I know there are ways to get clients IP using some of the methods below. getRemoteAddr, getRemoteHost and getRemotePort

So I'm asking other way around,Is there any way please post it here.

Thanks.

Upvotes: 0

Views: 1666

Answers (2)

Ryan Fernandes
Ryan Fernandes

Reputation: 8526

JSP by definition executes on the server side.
To get the date on the client machine, you'll have to execute something on the client. (javascript/applet etc)

In short, you will not be able to get the date on the client machine using just plain old JSP.

Upvotes: 0

piotrsz
piotrsz

Reputation: 1152

Actually there seems to be no suitable header for that. Maybe some solution would be to use request.getLocale() method and then play with DateFormat object created using that locale?

It is certainly not very reliable since you are not obliged to use locale matching your actual time zone.

Upvotes: 1

Related Questions