Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Displaying Time
 New Topic  Topic Locked
 Printer Friendly
Previous Page
Author Previous Topic Topic Next Topic
Page: of 2

RebelTech
Average Member

USA
613 Posts

Posted - 11 October 2003 :  21:13:59  Show Profile  Visit RebelTech's Homepage  Send RebelTech an ICQ Message
In using the code that I constructed from the internet, it works in an .asp by itself but, when I put it in the footer I get this error:
The only problem with the inet code by itself is that it reports 24: hours instead of 00: hours as it should be.
(error while in footer)
Illegal assignment: 's' 

/forum/inc_footer.asp, line 85


I am not sure why the footer killed it but, it seems both scripts are not handling the offset when the result = 24 / 00 hours.

Edited by - RebelTech on 11 October 2003 21:17:55
Go to Top of Page

RebelTech
Average Member

USA
613 Posts

Posted - 11 October 2003 :  21:36:01  Show Profile  Visit RebelTech's Homepage  Send RebelTech an ICQ Message
I tested a little. Here is what I found. I decreased the offset (was +4) till utc was 22:. I then increased offset by 1 each test. 22: hours - ok, 23: hours -ok, next increase - error
Go to Top of Page

RebelTech
Average Member

USA
613 Posts

Posted - 11 October 2003 :  21:53:50  Show Profile  Visit RebelTech's Homepage  Send RebelTech an ICQ Message
further update:
it is not just the 00 or 24 hour that is killing it. No matter what offset I use if the result goes to or past 00/24 it errors out. I assume that since my offset should be 4 that it will not work until the clock at my server hits midnight and then it is good for 20 hours.
Go to Top of Page

Roland
Advanced Member

Netherlands
9335 Posts

Posted - 11 October 2003 :  23:35:49  Show Profile
That's a good one that I hadn't thought about either.

Here's the new code, using Altis' forelast example (the last one errors out on me big time):

Dim strTimeNow, strHourNow, strMinNow, strSecNow
strHourNow = Hour(Now())
strMinNow = Minute(Now())
strSecNow = Second(Now())

If Len(strSecNow)=0 Then
  strSecNow = "00"
ElseIf Len(strSecNow)=1 Then
  strSecNow = "0" & strSecNow
End If

strTimeOffset = 7
strNewTime = (strHourNow - strTimeOffset)
if strNewTime < 0 then
	strNewTime = strNewTime + 24
end if
strTimeNow = strNewTime & ":" & strMinNow 
strTimeNow = FormatDateTime(strTimeNow, vbShortTime) & ":" & strSecNow

The lines that I added or where I changed something are in red. I've tested this and it works
Go to Top of Page

RebelTech
Average Member

USA
613 Posts

Posted - 12 October 2003 :  00:06:49  Show Profile  Visit RebelTech's Homepage  Send RebelTech an ICQ Message
Still get the error: (Type mismatch: 'FormatDateTime'

/forum/inc_footer.asp, line 95 )

My offset is +4
As long as it was subtracting it seemed ok. I didn't push it though. But, here in Texas we are -5 from UTC. My server is -4 from UTC. So I need to add 4 to get back to UTC. Here is your code with my offset.

Dim strTimeNow, strHourNow, strMinNow, strSecNow
strHourNow = Hour(Now())
strMinNow = Minute(Now())
strSecNow = Second(Now())

If Len(strSecNow)=0 Then
  strSecNow = "00"
ElseIf Len(strSecNow)=1 Then
  strSecNow = "0" & strSecNow
End If

strTimeOffset =4
strNewTime = (strHourNow + strTimeOffset)
if strNewTime < 0 then
	strNewTime = strNewTime + 24
end if
strTimeNow = strNewTime & ":" & strMinNow 
strTimeNow = FormatDateTime(strTimeNow, vbShortTime) & ":" & strSecNow
Go to Top of Page

RebelTech
Average Member

USA
613 Posts

Posted - 12 October 2003 :  00:12:12  Show Profile  Visit RebelTech's Homepage  Send RebelTech an ICQ Message
(strTimeNow, vbShortTime)

Is the error because after adding to strTimeNow it is no longer a date object?
In RB we would have ParseDate() I think.

Edited by - RebelTech on 12 October 2003 00:13:15
Go to Top of Page

Roland
Advanced Member

Netherlands
9335 Posts

Posted - 12 October 2003 :  00:17:11  Show Profile
Try this... change the following part
if strNewTime < 0 then
	strNewTime = strNewTime + 24
end if

to this:
if strNewTime < 0 then
	strNewTime = strNewTime + 24
elseif strNewTime > 23 then
	strNewTime = strNewTime - 24
end if
Go to Top of Page

RebelTech
Average Member

USA
613 Posts

Posted - 12 October 2003 :  00:37:27  Show Profile  Visit RebelTech's Homepage  Send RebelTech an ICQ Message
You sir appear to be a vb guru. This one went just fine. I learned a lot from this session and i feel more confident in wading into my forum files and mutilating the hec out of them Really, thanks and I enjoyed the lessons I learned. I am anxious to keep an eye on it for the day or so. How will it report 00 UTC? As 00 or 24? Would there have been a problem in the previous incarnation if I would have just subtracted enough hours to get UTC? I gotta say thanks again.
Go to Top of Page

RebelTech
Average Member

USA
613 Posts

Posted - 12 October 2003 :  00:39:33  Show Profile  Visit RebelTech's Homepage  Send RebelTech an ICQ Message
I need to learn what a carriage returns is!
Go to Top of Page

Roland
Advanced Member

Netherlands
9335 Posts

Posted - 12 October 2003 :  00:43:42  Show Profile
midnight will be shown as 00:00:00
you could've subtracted 20 hours instead of adding 4 hours, but with the codes as they are now, with the last bit of code included, it can be used by anyone whether they need to add or subtract hours

Since this is now a MOD including the necessary codes, I'll move this topic to the MOD W/ Code forum
Go to Top of Page

RebelTech
Average Member

USA
613 Posts

Posted - 12 October 2003 :  00:46:59  Show Profile  Visit RebelTech's Homepage  Send RebelTech an ICQ Message
Hec, I am tempted to put all kinds of times all over my forum now!
Go to Top of Page

cyber Knight
Starting Member

41 Posts

Posted - 12 October 2003 :  10:11:50  Show Profile
how about

<%= Now() %>

Go to Top of Page

Roland
Advanced Member

Netherlands
9335 Posts

Posted - 12 October 2003 :  11:09:28  Show Profile
quote:
Originally posted by cyber Knight

how about

<%= Now() %>




And how do you suppose that'll help display the time with a certain offset? Please try reading all posts in a topic before you make a reply like that.
Go to Top of Page

cyber Knight
Starting Member

41 Posts

Posted - 12 October 2003 :  14:27:11  Show Profile
SIR ,I was simply commenting on rebeltech's reply.
some users like to know that too.

since we got off topic a little ,chkout this :

ASP clocks

I guess the next reply will be something that might goes like "" hey C.K get your head out of your........""



Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Previous Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.24 seconds. Powered By: Snitz Forums 2000 Version 3.4.07