File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Passing current date/time with request Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Passing current date/time with request" Watch "Passing current date/time with request" New topic

Passing current date/time with request

Ricardo Estafan
Ranch Hand

Joined: Mar 29, 2004
Posts: 84
hello all,

is there a way that i can pass the current date and time with the request using javascript. I want to read out this information in the java-code (Struts application) handling the request. Does anyone know how to do this?
I want to execute this script preferably on a submit so i know exactly when the client submit a request or a post.

Thanks a lot!!
[ May 24, 2005: Message edited by: Ricardo Estafan ]
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
Something like this will get the users time:

BUT you have to remeber that this time is different than the servers, why don;t you just grab the servers time when you are saving the data to the database? Now sure why you would rely of JavaScript for this which can be disabled by the user.

Ricardo Estafan
Ranch Hand

Joined: Mar 29, 2004
Posts: 84
You are exactly correct, i am not sure my self. I want to measure the performance of a java application. Client time and server time, but come to think of it preferably without changing the existing code. Perhaps i will post this question in another topic.
I agree. Here's the link:
subject: Passing current date/time with request
It's not a secret anymore!