tags:

views:

262

answers:

2

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.

+1  A: 

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.

piotrsz
Thanks I'll try this up.
MMRUser
Locale loc = request.getLocale();Date date = new Date();Date date2 = new Date();DateFormat dfDate = DateFormat.getDateInstance(DateFormat.SHORT, loc);DateFormat dfTime = DateFormat.getTimeInstance(DateFormat.FULL, loc);String datee = dfDate.format(date);String timeT = dfTime.format(date2);System.err.println(datee);System.err.println(timeT);Is this a correct way to get the clients date and time. Please give me a clue.
MMRUser
why did you accept this answer if your question is still unanswered.
Ryan Fernandes
A: 

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.

Ryan Fernandes