473,327 Members | 2,069 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

How to convert a file creationtime to localtime

Hi,

I'm a newbie to VB.NET and I'm having some difficulty in viewing the
file creation time. Most links I have read do not seem to have any
problem with viewing such information, but all I get is a date in the
year 1601??!!

Here's the code that I'm using:

------------------

Imports System.IO.File
....
Dim FileProperties As System.IO.Fileinfo(filepath)
Dim FileDate As String

FileDate =
DateTime.FromFileTime(FileProperties.CreationTime. ToFileTime).ToLocalTime.ToLongDateString

--------------

This gives me the date as "01/01/1601 11:00 AM"

I have seen someone doing it much simpler with:

--------------

Dim fileName As String = "C:\Download\readme.txt"
Dim fileData As String
Dim fileDetails As System.IO.FileInfo = New
System.IO.FileInfo(fileName)

With fileDetails
fileData = "File was created at: " & _
.CreationTime.ToShortDateString
End With

-------------

....and apparently that was sufficinet. This doesn;t work for me either.

Any help would be much appreciated.

Thanks,
Darkie

Nov 21 '05 #1
1 1548
Darkie,

I assume that sending twice was a misunderstanding, however for others who
will see the given answers. 18 minutes later there is the same question from
Darkie in this newsgroup.

Please wait next time a little while if a message shows up.

Therefore I use this one with the outlook express newsreader.

news://msnews.microsoft.com/microsof...t.languates.vb

I hope this helps,

Cor
Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Soundneedle | last post by:
Does anyone have any code snips that retrieves a file's (txt, xl, etc) created, accessed, and modified date properties? I've searched this group and couldn't find anything simple.... TIA
0
by: troutbum | last post by:
I am experiencing problems when one user has a document open through a share pointing to the web site. I use the dsolefile to read the contents of a particular directory and then display them in a...
3
by: Martin Ho | last post by:
Can someone help me with this please? I wasn't very clear in my old post. I have a program to copy files from one location to another, now I want to copy only those files which were created on...
2
by: Roger | last post by:
I am using .net filinfo object. I have several file in a directory on a server. (NT). When I run a simple check of each files creation date/time I am using .Net finfo creationTime. I verify...
2
by: d_darkie07 | last post by:
Hi, I'm a newbie to VB.NET and I'm having some difficulty in viewing the file creation time. Most links I have read do not seem to have any problem with viewing such information, but all I get...
1
by: Tim Failes | last post by:
This seems a trival question, but I cannot get it to work properly... Essentially my question is, how can I create a text file, and guarantee it is given the current date/time as the Creation Time?...
3
by: booksnore | last post by:
Riddle me this... I have an app which listens to a windows folder for files to appear and then processes the file based on the file format. My question is if a really big file appears in the folder...
7
by: Angus Comber | last post by:
Hello I need to do this conversion but can't seem to find the function. Angus
2
by: jkflens | last post by:
Hello, i convert one XML-document by using XSLT into another XML-document. First change all attributes to elements is no problem. Then i try to insert a new element into the new document by...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.