[VB6] File date and time stamp. How to read into variable?

In summary, you can use the FileDateTime function in VB6 to retrieve the date and time stamp of a file, and the SetFileDateTime function to modify it. To convert the stamp into a readable format, you can use the Format function. The Dir function can be used to retrieve the stamp without opening the file, and the DateDiff function can be used to compare two stamps.
  • #1
cavemen
42
0
Hello. I am trying to create a VB6 program that would keep track of date and time when a new file was created. And and plot it in a graph.

What VB6 command can allow me to convert file date and time stamp into a variable?
What command can help me move a file from one folder to the other?

Yes I am using the Visual Basic 6. It is simple.
No VB.NET, no C# no modern complex B.S.
 
Technology news on Phys.org
  • #2
FileDateTime("C:\Somefile.txt")

My.Computer.FileSystem.MoveFile("C:\Somefile.txt", "C:\hello\Somefile.txt")
 
  • #3
thank you for helping
 

1. How do I get the date and time stamp of a file using VB6?

In order to get the date and time stamp of a file in VB6, you can use the FileDateTime function. This function takes in the file path as an argument and returns the date and time stamp of the file as a Date data type.

2. Can I modify the date and time stamp of a file using VB6?

Yes, you can modify the date and time stamp of a file using VB6. You can use the SetFileDateTime function to set a specific date and time for the file. This function takes in the file path and the desired date and time as arguments.

3. How can I convert the date and time stamp into a readable format?

You can use the Format function in VB6 to convert the date and time stamp into a readable format. This function takes in the date and time stamp as a Date data type and a format string as arguments, and returns a formatted string.

4. Is it possible to retrieve the date and time stamp of a file without opening it?

Yes, it is possible to retrieve the date and time stamp of a file without opening it. You can use the Dir function to get the file name and then pass it to the FileDateTime function to get the date and time stamp.

5. How do I compare two date and time stamps in VB6?

To compare two date and time stamps in VB6, you can use the DateDiff function. This function takes in the date and time stamps as Date data types and a time interval as arguments, and returns the difference between the two in the specified time interval.

Similar threads

  • Programming and Computer Science
3
Replies
81
Views
5K
  • Programming and Computer Science
Replies
3
Views
4K
  • Programming and Computer Science
Replies
4
Views
737
Replies
10
Views
952
  • Programming and Computer Science
Replies
5
Views
5K
  • Programming and Computer Science
Replies
4
Views
8K
  • Programming and Computer Science
Replies
1
Views
2K
  • Programming and Computer Science
Replies
4
Views
4K
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
2
Views
2K
Back
Top