Login
`
Templates, Tools and Utilities
|
||
Add a comment to an Icetips ArticlePlease add your comments to this article.
Please note that you must provide both a name and a valid email address in order
for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!
Back to article list Search Articles Add Comment Printer friendly Direct link Par2: Parsing Clarion times 2006-10-18 -- Randy Goodhew You can instantly parse a Clarion Standard Time (as a LONG) into its
time components by using this trick:
BTime TIME,AUTO
BTovr GROUP(BTime)
Hundredths BYTE
Seconds BYTE
Minutes BYTE
Hours BYTE
END !group
TTime LONG
CODE
BTime = TTime ! auto-converts Clarion Time to Btrieve Time
Now you can get each time component from the over cast array, e.g.
BTovr.Hours
BTovr.Minutes
BTovr.Seconds
BTovr.Hundredths
Note: When Clarion auto-converts a Clarion Standard Time (LONG) to a
Btrieve Time, it automatically subtracts 1, the Midnight bias value.
Also, you can get AM/PM directly from the TTime LONG by using these
EQUATEs to do comparisons:
NoTime EQUATE(0)
Midnight EQUATE(1)
Noon EQUATE(4320001)
MaxTime EQUATE(8640000)
EndOfAM EQUATE(Noon - Midnight)
EndOfPM EQUATE(MaxTime)
Example:
AMPM STRING(2)
CODE
IF TTime => Midnight AND TTime =< EndOfAM
AMPM = 'AM'
ELSIF TTime > EndOfAM AND TTime =< EndOfPM
AMPM = 'PM'
ELSE
AMPM = ''
END !if
Today is November 21, 2024, 7:20 am This article has been viewed 35255 times.
|
|