The code I presented did the requisite bit shifts (by doing a division).
Maybe explicit bitshift routines are available in VB, but the divisions
should work either way.

I still don't quite see *exactly* what you are storing in the Palm databases
to represent your dates. If it's not a DateType then the bitshifts don't
matter and you'll likely need to do something else. That "something else"
depends on exactly what it is you are storing. Where do you get the data
from in the first place on the Palm? What OS routine are you calling. Show
me some code and I can stop poking around in the dark.

Gavin.

-----Original Message-----
From: K.S. Jaishankar [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 15 January 2002 5:03 PM
To: Palm Developer Forum
Subject: RE: Reading Date & Number fields from Byte Array


Thanks Gavin

I am not able to workout bitshift functions in VB. In VB we do not have any 
bitshift operators. Any idea how to it?

I have tried to read the date (i.e., 1/2/2002 m/d/yyyy format) from the 
Palm.

I tried to Convert them to Hex frist (first 4 bytes) i.e.,
000000  B8 56 AC 80
Converting this to Decimal (as it is) will give signed long.
Like;
?val(&H80AC56B8&)
-2136189256
?val(&HB856AC80&)
-1202279296

I have confusion here, how to do bit shift on this number? I am right to say

so or I have to bit shift before converting the bytes into Hex.  Anyway I am

confused now.

Any idea how to solve this.

Thanks
With Regards
K.S.Jaishankar




>From: Gavin Maxwell <[EMAIL PROTECTED]>
>Reply-To: "Palm Developer Forum" <[EMAIL PROTECTED]>
>To: "Palm Developer Forum" <[EMAIL PROTECTED]>
>Subject: RE: Reading Date & Number fields from Byte Array
>Date: Mon, 14 Jan 2002 10:20:22 +0800
>
>Nope. The ByteArrayToXXX routines handle byte-swapping for you, and from
>memory should handle all the standard integer types.
>
>Exactly which types are you storing on the Palm? There was some discussion 
>a
>few days ago about this I think. If you are storing DateType structures
>(which are a 2-byte bitfield) you'll have to resort to bitshifts to extract
>it. Not too hard though. Something like this might work. NB: I haven't 
>tried
>this - and I'm not a VB expert! :-)
>
>     'typedef struct {
>     'UInt16 year  :7;
>     'UInt16 month :4;
>     'UInt16 day   :5;
>     '} DateType;
>
>     Dim month As Integer, day As Integer, year As Integer
>
>     day = theMatchRecord.matchDate And &H1F
>     month = (theMatchRecord.matchDate And &H1E0) \ &H1F
>     year = ((theMatchRecord.matchDate And &HFE00)) \ &H200
>
>Also you might get a better response over at the conduits list - that's
>where all those wierd conduit developers hang out! :-)
>
>
>Have fun,
>
>Gavin.
>
>-----Original Message-----
>From: Michael Glickman [mailto:[EMAIL PROTECTED]]
>Sent: Monday, 14 January 2002 11:37 AM
>To: Palm Developer Forum
>Subject: RE: Reading Date & Number fields from Byte Array
>
>
>
>
>-----Original Message-----
>From: K.S. Jaishankar [mailto:[EMAIL PROTECTED]]
>Sent: Sunday, 13 January 2002 10:43 PM
>To: Palm Developer Forum
>Subject: Reading Date & Number fields from Byte Array
>
>
> > I have difficulties in reading database fields of type
> > Date and Currency/Double/Single/Long/Int to synchronize the ODBC 
>database.
>I
> > have tried to use ByteArrayToBSTR, ByteArrayToDWord and ByteArryToWord
> > functions for converting them, however was not successful in getting 
>date
> > and numeric values.
>
>As a matter of fact, Palm fields are big-enfdian, while Intel has a
>little-endian architecture. I do not design conduits (well, until we get a
>documentation on pilot-link libraries :=)), but you might need calling 
>ntohs
>and htonl to swap byte order.
>
>Michael
>
>--
>For information on using the Palm Developer Forums, or to unsubscribe,
>please see http://www.palmos.com/dev/tech/support/forums/
>
>--
>For information on using the Palm Developer Forums, or to unsubscribe, 
>please see http://www.palmos.com/dev/tech/support/forums/




K.S.Jaishankar
Phone:98717915 (Mobile), 2717520 (Res)
Email:[EMAIL PROTECTED]
      [EMAIL PROTECTED]



_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


-- 
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to