WP7 - 隔离文件创建日期/时间格式?

时间:2013-11-24 00:53:50

标签: vb.net windows-phone-7 listbox

我只是想知道是否有办法可以获取文件的创建日期和时间。为了简化目前这是我得到的:

 Dim Storage As IsolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication()
    Dim directory As String = "./SafeLockPLUS/SavedAccounts/*.*"
    Dim filenames As String() = Storage.GetFileNames(directory)
    Dim dataSource As New List(Of SampleData)()
    For Each filename As String In filenames
        Dim ISF As IsolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication()
        Dim FS As IsolatedStorageFileStream = ISF.OpenFile("SafeLockPLUS/SavedAccounts/" & filename, FileMode.Open, FileAccess.Read)
        Using SR As New StreamReader(FS)
            Dim Tme1 As String = Storage.GetLastWriteTime("/SafeLockPLUS/SavedAccounts/" & filename).DateTime.ToString(CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern)
            Dim DATESS As String = SR.ReadLine
            Dim ReadName As String = SR.ReadLine
            Dim DATESSx2 As String = SR.ReadLine
            Dim Nte As String = SR.ReadLine
            dataSource.Add(New SampleData() With {.Name = filename, .Description = ReadName, .Tme = Tme1, .Notes1 = Nte})
        End Using
    Next
    SavedAccountslst.ItemsSource = dataSource

因此,文件创建的时间格式就像例如下午3:22下午4:22但问题是,我说我在2013年12月12日下午2:34创建了文件,并且我在2013年11月11日再次查看该文件,文件创建日期。时间将显示为下午2:34甚至虽然它是在一段时间后创建的。我怎么能这样做,它会显示创建当天的时间,但如果我稍后检查,例如2到3天后,它会显示11/12或Tue之类的东西。就像你去消息列表时一样,它会显示时间,但稍后会显示它的日期,而不是时间。

0 个答案:

没有答案