Print Page | Close Window

Two questions about time.

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=5073
Printed Date: 30 March 2026 at 4:44pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Two questions about time.
Posted By: Aumuz
Subject: Two questions about time.
Date Posted: 16 August 2003 at 1:33pm

I have two questions about time...

1. <%= time %> Does this dispaly the server time, or the local time for the viewer?

2. How do I edit time? I have noticed <%= time+1 %> and similare scripts don't work. I keep geeting this "12/31/1899 3:37:19 PM" (how did it come up with that?).




Replies:
Posted By: michael
Date Posted: 16 August 2003 at 5:08pm
1. It does display the server time, asp is always server.
2. If you display time it does not have a date associated with it. So if you add the date 1 to the time 1 it start "at the beginning of time" Well Stephen Hawking says it was when the big bang occured, Bill Gates said it was December 30, 1899. So if you add 1 to that you get Sunday, December 31, 1899. If you want to calculate with times you need to actually get the server date. You can do that with something like now() and now() + 1 would equal tomorrow that same time. Now that is not a very nice way of doing it cause you may want to add or substract minutes, hours, weeks or years. For that you can use the datepart function so i.e. now() + datepart("y",1) would add a year to the current time. 

-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: b_bonnett
Date Posted: 16 August 2003 at 5:08pm

1. It displays the server time.

2. Use the DateAdd function to edit the time. See http://www.w3schools.com/vbscript/func_dateadd.asp for details on how to use it.

Edit: Just beat me to it Michael!

Blair



-------------
Webmaster, http://www.planegallery.net/ - The Plane Gallery
Greetings From Christchurch


Posted By: Aumuz
Date Posted: 16 August 2003 at 7:06pm

I figured it out (forgot to edit my post)...

<%= time+.001 %> will offset the time min... <%= time+.01 %> ten min... <%= time+.1 %> one hour and so on.

But thanks for your help.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net