[thelist] ASP & Access - Using the same variable twice

aardvark roselli at earthlink.net
Sun Nov 25 11:19:47 CST 2001


> From: "Christian Anderson" <ckanderson at powersurfr.com>
[...]
> My server is somewhere in teh USA, and Im in Japan.  I want to have a
> script that pulls things out according to the current date, but with
> the big time difference, I dont know what I can do.
> 
> So in my select statement, do I do a WHERE dDATE = [fn_serverdate](or
> whatever that is, I dont really remember) + 14 hours ?
[...]

this depends... i had a site where i needed to calculate the time in 
the netherlands while the server sat on the US east coast... since i 
had to display the time, i already had a chunk of ASP script to do 
the conversion, so i didn't need to do it in my SQL statement as 
well... that chunk of script (which you can easily make into a 
function):

<%
'## Generate Netherlands time by adding 6 to east coast time

rightNow = Now
nowHour = Hour(DateAdd("h",6,rightNow))

IF nowHour = 0 THEN
	nowHour = 12
	AmPm = "AM"
ELSEIF nowHour > 12 THEN
	nowHour = nowHour - 12
	AmPm = "PM"
ELSEIF nowHour = 12 THEN
	AmPm = "PM"
ELSE
	AmPm = "AM"
END IF

nowMinute = Minute(rightNow)

IF nowMinute < 10 THEN
	nowMinute = "0" & nowMinute
END IF

%>

when i called it in my script to display on the page:
<% = nowHour %>:<% = nowMinute %>&nbsp;<% = AmPm %>

however, you'll need the 24-hour format for the SQL query, i 
assume, and i'm sorry to say i can't find that part of my script... but 
this should get you started in the right direction...





More information about the thelist mailing list