TIP: Click on subject to list as thread! ANSI
echo: power_bas
to: ALL
from: DAVE NAVARRO
date: 1998-01-21 16:18:00
subject: PBDLL5: FileDateTime

From: dave@powerbasic.com (Dave Navarro)
Subject: PBDLL5: FileDateTime
 
'=============================================================================
=
'
' FileDateTime for PB/DLL 5.0
' Copyright (c) 1998 by PowerBASIC, Inc.
'
'=============================================================================
=
 
$COMPILE EXE
$INCLUDE "WIN32API.INC"
 
FUNCTION FileDateTime(BYVAL Filenam AS STRING) AS STRING
 
  LOCAL fd    AS WIN32_FIND_DATA
  LOCAL fh    AS LONG
  LOCAL zText AS ASCIIZ * 255
  LOCAL st    AS SYSTEMTIME
  LOCAL Temp  AS STRING
 
  zText = Filenam
 
  ' -- Find the file
  fh = FindFirstFile(zText, fd)
  IF fh = %INVALID_HANDLE_VALUE THEN
    EXIT FUNCTION
  END IF
  FindClose fh
 
  ' -- Convert the file time from UTC to local time
  FileTimeToLocalFileTime fd.ftLastWriteTime, fd.ftLastWriteTime
 
  ' -- Convert the file time into a compatible system time
  FileTimeToSystemTime fd.ftLastWriteTime, st
 
  ' -- Create a date string using the local settings
  GetDateFormat %LOCAL_USER_DEFAULT, %DATE_SHORTDATE, st, BYVAL %NULL, zText,
255
  Temp = zText
 
  ' -- Create a time string using the local settings
  GetTimeFormat %LOCAL_USER_DEFAULT, %TIME_NOSECONDS, st, BYVAL %NULL, zText,
255
 
  ' -- Return the file date and time
  FUNCTION = Temp + "  " + zText
 
END FUNCTION
 
FUNCTION WinMain (BYVAL CurInst&, _
                  BYVAL PrvInst&, _
                  CmdLine AS ASCIIZ PTR, _
                  BYVAL CmdShow&) EXPORT AS LONG
 
  MsgBox FileDateTime("C:\AUTOEXEC.BAT")
 
END FUNCTION
 
*** QwkNews (tm) v2.1
 * [TN11.1] Internet Newsgroup: alt.lang.powerbasic
--- GEcho 1.20/Pro
---------------
* Origin: Toast House Remote (1:100/561)

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™.