Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pervasive Time data field

Status
Not open for further replies.

hanglam

Programmer
Dec 11, 2002
143
US
I'm not sure if this a pervasive feature but here it goes.
My company bought this application which uses pervasive as the backend. In the database one of the fields is a TIME field. But when I use Pervasive Control Center to examine the tables, some of the TIME Fields are saved as 7-digits numbers, i.e. "3352919" .
Is this how pervasive saved TIME fields ? If so, does anyone knows how to convert this number into a normal time fields, i.e "12:02 PM" ?

Thanks,
Scott
 
Is the field defined as "Time" in the table (right click on the table as select "Edit Table Design")? Are some of the rows showing a correct time? If so, check out the application that's creating the data. Make sure it's giving the proper data to Pervasvie.

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
Custom VB and Btrieve development.
 
The time field is 4 bytes in length where four integers represents the following:
Hour is byte 4
Minute is byte 3
Second is byte 2
Hundredths of second is byte 1

So if a program reads this as a 4 byte integer then you will have a value that represents a long integer. For example this number represents this time.
287252224 = 17:31:31

Hope that helps.


Gil
 
thanks guys for you quik responses.
WE just contacted the vendor and they will send us the information about how they populate their TIME fields.
 
Here is the answer that I got from the vendor:

7 digit number = (Hours * 360000) + (Minutes * 6000) + (Seconds * 100).

Example:

Time: 09:18:50 (HH:MM:SS)
Number = 09 * 360000 + 18 * 6000 + 50 *100 = 3353000

Data:
Number = 7 digit long number = 3352919
Hour = Hours (HH from HH:MM:SS)
Min = Minutes (MM from HH:MM:SS
Sec = Seconds (SS from HH:MM:SS)

Steps to convert this number into actual time format.

1. Hour = Integer (Number / 360000)

Hour = Integer (3352919 / 360000) = 09

2. Number = Number - Hour * 360000

Number = 3352919 - 09 * 360000 = 112919

3. Min = Integer (Number / 6000)

Min = Integer (112919 / 6000) = 18

4. Number = Number - Min * 6000

Number = 112919 - 18 * 6000 = 4919

5. Sec = Integer (Number / 100)

Sec = Integer (4919/ 100) = 49

Output:
Hour:Min:Sec = 09:18:49
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top