Stored dates

 BBS: Inland Empire Archive
Date: 04-18-92 (18:11)             Number: 200
From: DAVE EMORY                   Refer#: NONE
  To: SCOTT WUNSCH                  Recvd: NO  
Subj: Stored dates                   Conf: (2) Quik_Bas
In a msg dated <Friday April 17 1992>, Scott Wunsch wrote to All:

 SW>   I am working on a program that uses INT 4Eh/4Fh to retrieve file
 SW> names, and then must process the date returned.  I have tried many
 SW> times to get the two-byte date spread out into day, month and year

Assuming DTA$ was returned from your interrupt call:

attribute%=asc(mid$(dta$,22,1))
tim&=cvi(mid$(dta$,23,2))
if tim&<0 then tim&=tim&+65536
second%=tim& AND &H1F
minute%=(tim&\32) AND &H3F
hour%=(tim&\2048) AND &H1F
dat&=cvi(mid$(dta$,25,2))
day%=dat& AND &H1F
month%=(dat&\32) AND &HF
year%=((dat&\512) AND &H1F)+1980
size&=cvl(mid$(dta$,27,4))
f$=mid$(dta$,31)+chr$(0)
finame$=left$(f$,instr(f$,chr$(0))-1)

But don't ask me how it works, please ;-)  TTYL -=- Dave

--- D'Bridge
 * Origin: The Bare Bones BBS * Aloha, OR * (1:105/360)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET