Accessing a Client’s date&time Within ASP

I have an ASP that records a text of notes created by a user. I save this note in a database along with a date&time stamp. If the client is in a different time zone, the app picks up the date&time from my server. I want to pick up the current date/time in the client’s time zone. How should I handle this?


One way to access the client’s date and time is to have it sent along with the other information in the form.

Ask the user to fill in the date and time, or get it using client side scripting.

If you need to use the scripting solution:

1. Have a hidden field in your form.


2. Define a function to run when the form is submitted.

3. Create a FillDateTime function using Client side Javascript.

4. In this function, use:

var dd = new date(); = dd;    return true;

This is necessary in order for the function to work properly.

5. In your Server Side ASP script, access the field “dt” to obtain the client side date and time. The date and time will have a format like this: Thu Jun 17 12:11:27 EDT 1999. Once this is set you can modify the format.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: