BBS: Inland Empire Archive Date: 11-04-92 (16:50) Number: 329 From: TONY ELLIOTT Refer#: NONE To: ROBERT CHURCH Recvd: NO Subj: Re: File's date and time Conf: (2) Quik_Bas
-=> Quoting Robert Church to All <=- RC> How do I get the date and time from the Dos DTA? I've got the DTA RC> structure and the FindFirst/FindNext routines, but how do I convert RC> the bit-mapped time and date portions of the DTA structure to RC> integers? Thanks Both the date and time are stored in DTA in 16 bits (integers). Here's a couple of functions we use to convert the bit maps into strings: FUNCTION FileDate$ (Date%) STATIC '--convert DOS file date to a date string '--date format MM-DD-YY UDate& = Date% IF UDate& < 0 THEN 'convert to unsigned integer UDate& = UDate& + 65536 END IF Yr% = UDate& \ 512 Mth% = (UDate& MOD 512) \ 32 Dy% = UDate& - Yr% * 512 - Mth% * 32 Yr% = Yr% + 1980 FileDate$ = RIGHT$(STR$(Mth% + 100), 2) + "-" + _ RIGHT$(STR$(100 + Dy%), 2) + "-" + RIGHT$(STR$(Yr%), 2) END FUNCTION FUNCTION FileTime$ (Time%) STATIC '--convert DOS file time to string '--time format HH:MM UTime& = Time% IF UTime& < 0 THEN 'convert to unsigned integer UTime& = UTime& + 65536 END IF Hr% = UTime& \ 2048 Mnt% = (UTime& MOD 2048) \ 32 FileTime$ = RIGHT$(STR$(100 + Hr%), 2) + ":" +_ RIGHT$(STR$(100 + Mnt%), 2) END FUNCTION Good luck! Tony ... Taglines are irrelevant. You will be assimilated into the Blue Wave. --- Blue Wave/Max v2.10 [NR] * Origin: Oakland BBS - McDonough, GA - (404) 954-0071 (1:133/706.0)
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