Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How I can get the Modified date of a file ?

How I can get the Modified date of a file ?

Scheduled Pinned Locked Moved C#
question
4 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    E_Gold
    wrote on last edited by
    #1

    Hi I make any File in PC, and I transfer him to PPC (Windows mobile) How I can get the Modified date of this file ? I try this: DateTime GG; FileInfo H = new FileInfo(@"c:\License.txt"); GG = H.CreationTime; GG = H.LastWriteTime; GG = File.GetCreationTime(@"c:\License.txt"); GG = File.GetLastAccessTime(@"c:\License.txt"); GG = File.GetLastWriteTime(@"c:\License.txt"); but I always get the Today date and time thank's in advance

    K 1 Reply Last reply
    0
    • E E_Gold

      Hi I make any File in PC, and I transfer him to PPC (Windows mobile) How I can get the Modified date of this file ? I try this: DateTime GG; FileInfo H = new FileInfo(@"c:\License.txt"); GG = H.CreationTime; GG = H.LastWriteTime; GG = File.GetCreationTime(@"c:\License.txt"); GG = File.GetLastAccessTime(@"c:\License.txt"); GG = File.GetLastWriteTime(@"c:\License.txt"); but I always get the Today date and time thank's in advance

      K Offline
      K Offline
      King Julien
      wrote on last edited by
      #2

      Yes the output is correct!! because you have transferred the file only today!!! so that is the latest write time!!!

      Have a Happy Coding.....

      E 1 Reply Last reply
      0
      • K King Julien

        Yes the output is correct!! because you have transferred the file only today!!! so that is the latest write time!!!

        Have a Happy Coding.....

        E Offline
        E Offline
        E_Gold
        wrote on last edited by
        #3

        thank's for the help What I can do to see the real creation date of the file ?

        K 1 Reply Last reply
        0
        • E E_Gold

          thank's for the help What I can do to see the real creation date of the file ?

          K Offline
          K Offline
          King Julien
          wrote on last edited by
          #4

          That is quite difficult to do AFAIK! You can try implement this logic with the corresponding code! 1.Before File Transfer operation to your mobile device --------------> copy the present Created Time, LastWrite time and lastAccess time to a temporary variable! 2.Copy the File! 3.And reset the Created Time, LastWrite Time and LastAccess Time from your temporary variable! since these are properties, you can able to set them! i believe!!! So if your copy function performs all this three steps, then you will always get the creation date of file as same as your computer!!!! It may work!!!

          Have a Happy Coding.....

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups