TIP: Click on subject to list as thread! ANSI
echo: delphi
to: STEVE BATSON
from: SEAN FOLEY
date: 1996-07-15 05:12:00
subject: Date Routines

 > I am trying to write a program to manage my user base on my
 > BBS. The BBS software is called SpitFire and the Subscription
 > date is defined in a record as type Longint. I have tried
 > several of the delphi date routines with no success. Can
 > someone give a small code example of how to decode a date in
 > this format?
  This is just an assumption, but this is what I think the programmer did: 
he's packing the date into the Longint.  Why?  A Longint is 32 bits or 4 
bytes.  Each unsigned byte can represent values of 0..255.  All you need to 
do is combine those values bitwise into the Longint.  For example:
             Most Sig. Byte........................Least Sig. Byte
             Month           DAY                  YEAR
            (byte 3)       (byte 2)     (byte 1 msb)   (byte 0 lsb)
            ------------------------------------------------------
Decimal        07             15           19             96
binary      0000 0111       0000 1111   0001 0011       0110 0000
Hex            7h             fh           13h            60h
            ======================================================
Bit pattern   0000 0111 0000 1111 0001 0011 0110 0000
Hex          70f1360h
Dec          118,428,512
  So using this scheme, 7/15/1996 could be 'packed' into a Longint (4 bytes) 
as 7f1360h.
  You will have to guess which byte is being used for what.  Use the bbs to 
create a subscription with the month and year constant, just change the day 
(7/15/96..7/16/96) and then reading in the longint and comparing which byte 
changed value.  Then do the same with the day and year (7/15/96..8/15/96)
  Posting the resultant integer for a given date to this echo would help also 
.  Hope this helps...
Sean
--- System Support BBS
---------------
* Origin: System Support BBS (1:202/1609)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.