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 DEV-Group
 DEV Bug Reports (Closed)
 BUG+FIX(All) 12Hr Time Format Display Problem
 Forum Locked  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

GauravBhabu
Advanced Member

4288 Posts

Posted - 25 June 2001 :  13:20:38  Show Profile
While testing the Mod_CollapseCats, which I created, I found an error in date display when the Time format is 12 Hours. The 0 from the hour is truncated if the time is between 1 PM and 9.59.59PM. The date and time are stored as string in the database as below
"20010625135959". The last 6 digits referring to Time 135959. This will display as 1:59:59 PM in 12 HR time format.

I have implemented the following solution to correct this error:

I made changes in the inc_functions.asp as below:

Find this line in your inc_functions.asp (about or near line 725)

function ChkTime(fTime)
 
function ChkTime(fTime)
if fTime = "" then
exit function
end if
if strTimeType = 12 then
if cint(Mid(fTime, 9,2)) > 12 then
ChkTime = ChkTime & " " & _
(cint(Mid(fTime, 9,2)) -12) & ":" & _
Mid(fTime, 11,2) & ":" & _
Mid(fTime, 13,2) & " " & "PM"

elseif cint(Mid(fTime, 9,2)) = 12 then



I modified it as below:


if strTimeType = 12 then
if cint(Mid(fTime, 9,2)) > 12 then
if cint(Mid(fTime, 9,2)) > 21 then
ChkTime = ChkTime & " " & _
(cint(Mid(fTime, 9,2)) -12) & ":" & _
Mid(fTime, 11,2) & ":" & _
Mid(fTime, 13,2) & " " & "PM"
else
ChkTime = ChkTime & " 0" & _
(cint(Mid(fTime, 9,2)) -12) & ":" & _
Mid(fTime, 11,2) & ":" & _
Mid(fTime, 13,2) & " " & "PM"
end if
elseif cint(Mid(fTime, 9,2)) = 12 then




It works okay. But I have not tested if it will have any side effects. Chances are less. If anyone has a better idea. I think there might be a method to avoid truncation of zero. Left side zero is being truncated.

GauravBhabu

There is only one miracle...That is LIFE!

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 25 June 2001 :  13:37:45  Show Profile  Visit HuwR's Homepage
This is entirely correct, you do not normally have a preceding 0 in 12 hour time format, just in 24 hour

Go to Top of Page

GauravBhabu
Advanced Member

4288 Posts

Posted - 25 June 2001 :  14:12:32  Show Profile
quote:

This is entirely correct, you do not normally have a preceding 0 in 12 hour time format, just in 24 hour





Check the time display when the time is between 12.00AM and 11.59.59 AM. It displays with a preceding zero.
for example

01:59:59 AM. Check on any snitz forum. Am time display is with a preceding 0 and PM time display without preceding zero.
GauravBhabu

There is only one miracle...That is LIFE!
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 25 June 2001 :  16:13:28  Show Profile  Visit HuwR's Homepage
Ok, now I see what you mean, there is howvere a much quicker solution.

change this line
(cint(Mid(fTime, 9,2)) -12) & ":" & _

to this
doublenum(cint(Mid(fTime, 9,2)) -12) & ":" & _


doublenum is a function in inc_functions which appends a zero to numbers below 10

Moved to BUG forum.

Go to Top of Page

GauravBhabu
Advanced Member

4288 Posts

Posted - 25 June 2001 :  16:16:37  Show Profile
quote:

Ok, now I see what you mean, there is howvere a much quicker solution.

change this line
(cint(Mid(fTime, 9,2)) -12) & ":" & _

to this
doublenum(cint(Mid(fTime, 9,2)) -12) & ":" & _


doublenum is a function in inc_functions which appends a zero to numbers below 10

Moved to BUG forum.






That is the solution I was looking for. Mine was crude. Thanks!

GauravBhabu

There is only one miracle...That is LIFE!
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.15 seconds. Powered By: Snitz Forums 2000 Version 3.4.07