Forum Moderators: open

Message Too Old, No Replies

Dispalying day of week ahead of server time

I am tring to show our time and day of eweek as we are several hours ahead

         

peter andreas

12:15 pm on Jul 21, 2004 (gmt 0)

10+ Year Member



Sorry if this is a simple question but I have been trying to find an answer for hours now. looking at all sortds of asp pages and boooks I have found snippets but not enough

We are located 15 hours ahead of our server and I want to dispaly our day of week time etc.

Timeus=dateAdd("h",15, time)
The time with us is: <%response.write Timeus%>.

Which give the time Ok but I can't figure out how to display the day ie Its wednesday today (some times we are into the next day ahead of our server) etc
I have tried the below but it still shows the same day even if I know we are into the next day
<%response.write WeekdayName(weekday(dateAdd("h",15,date)))%>

Any ideas appreciated-Thanks

digitalv

1:03 pm on Jul 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try using "now" instead of DATE or TIME ...

Timeus = DateAdd("h",15,now)

When you use DATE, the time is always midnight, so adding 15 hours to midnight on the current day still makes it the same day.

Adding 15 hours to "now" however, could possibly roll over into the next day if 15 hours from now is tomorrow and tada, you're in the future. When you get this running though, don't tell us what happens in the next 15 hours because we like to be surprised :)

duckhunter

1:11 pm on Jul 21, 2004 (gmt 0)

10+ Year Member



This should do it for you.

var1 = dateAdd("h",15,Now())
Response.Write("var1 = " & var1 & "<br>")
Response.Write("For var1 the weekday is " & WeekDay(var1, 1) & "<br>")
Response.Write("For var1 the weekdayname is " & WeekDayName(WeekDay(var1), false, 1) & "<br>")

Returns:
var1 = 7/22/2004 12:10:13 AM
For var1 the weekday is 5
For var1 the weekdayname is Thursday