Wrox Programmer Forums
ASP Pro Code Clinic As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Pro Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 10th, 2004, 05:05 AM
Authorized User
Join Date: May 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default javascript Date???

I want to dispaly the current year in html files for which i have used javascript date function getFullYear(),But the problem is if the client changes the year in his machine means it display the changed year instead of current year. is there any to give solution to my problem???? without goin for remote script or hardcoded in the html file....
thanx in advance murali.A

Old May 10th, 2004, 05:20 AM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

Hi there,

Well, that makes sense, doesn't it? The JavaScript has to find out the year from a source, and that source happens to be the computer's clock.

If you're using ASP, you could easily pass the year at the server to a JavaScript variable:
<script type="text/javascript">
  var serverYear = <%=Year(Now())%>;
This passes the current year of the server to a JavaScript variable at the client.


Imar Spaanjaars
Everyone is unique, except for me.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Working with Forms and Date in Javascript danieljava Pro JSP 1 January 16th, 2006 05:56 AM
JavaScript and Date Edits srotondo Javascript How-To 3 February 2nd, 2005 01:32 AM
Date object javascript marclena Javascript How-To 2 September 10th, 2004 10:15 AM
insert date (javascript) into access katie456 Access 1 October 11th, 2003 09:24 AM
validate date javascript lcsgeek Classic ASP Basics 3 October 3rd, 2003 04:07 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.