DOS Date and Time stamps

Area:    Quik_Bas
  Msg:    #316
 Date:    03-18-93 20:34 (Public) 
 From:    MARTY DUPLISSEY          
 To:      Robert Church            
 Subject: DOS Date and Time stamps 
Blabbering as if I knew what I was talking about!

In a msg of <16 Mar 93>, Robert Church mumbled incoherently to All:

 RC> How do you convert the bit-mapped DOS date and time stamps in the DTA
 RC> to QB useable variables?  I'd like to convert them to INTEGERs for:

 RC> Month%, Day%, Year%, Hour%, Minute%, Second%

This is a part of a post I snagged a while back. I appologize
to the original poster as I can't remember who it was.<g>


TYPE DTADatatype
   Unused AS STRING * 21
   attr AS STRING * 1
   Time AS INTEGER
   Date AS INTEGER
   FileSize AS LONG
   FileName AS STRING * 13
END TYPE

   FSz& = DTA.FileSize
   Yr% = (DTA.Date AND &H7FFF) \ 512 + 80
   IF DTA.Date < 0 THEN Yr% = Yr% + 64
   IF Yr% > 99 THEN Yr% = Yr% - 100
   Mon% = ((DTA.Date AND &H7FFF) \ 32) AND &HF
   Dy% = DTA.Date AND &H1F
   Hr% = (DTA.Time AND &H7FFF) \ 2048
   IF DTA.Time < 0 THEN Hr% = Hr% + 16
   Min% = ((DTA.Time AND &H7FFF) \ 32) AND &H3F
   Sec% = (DTA.Time AND &H1F) * 2
   Nm$ = DTA.FileName
   J% = INSTR(Nm$, CHR$(0))
   Nm$ = LEFT$(Nm$, J% - 1)
   attr$ = STRING$(6, 32)
   IF (ASC(DTA.attr) AND &H20) <> 0 THEN MID$(attr$, 1, 1) = "A"
   IF (ASC(DTA.attr) AND &H10) <> 0 THEN MID$(attr$, 2, 1) = "D"
   IF (ASC(DTA.attr) AND &H2) <> 0 THEN MID$(attr$, 3, 1) = "H"
   IF (ASC(DTA.attr) AND &H1) <> 0 THEN MID$(attr$, 4, 1) = "R"
   IF (ASC(DTA.attr) AND &H4) <> 0 THEN MID$(attr$, 5, 1) = "S"
   IF (ASC(DTA.attr) AND &H8) <> 0 THEN MID$(attr$, 6, 1) = "V"


MARTY

--- GoldED 2.40
 * Origin: World Link, Longview,TX.USA OS/2 (903-643-7607) (1:398/1)


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