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. Ionic.Zip Date Problems.

Ionic.Zip Date Problems.

Scheduled Pinned Locked Moved C#
help
3 Posts 2 Posters 0 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.
  • O Offline
    O Offline
    ormonds
    wrote on last edited by
    #1

    I have code which unzips a file over others, but first checks the date of a special file to make sure it is newer. The ModifiedTime of the file is found using:

    using (ZipFile zip = ZipFile.Read(OriginalFileName))
    try
    {
    ZipEntry z = zip["save_history.log"];
    NewFileAge = z.ModifiedTime;
    }
    catch......

    WinZip shows the date of the file as 26/02/2019 3:56 PM. Extraction confirms this. The value of NewFileAge in the code above is 26/02/2019 2:56 PM. The only references I can find to this refer to remote servers in different time zones. All these files are on one computer. Yes, it looks suspiciously like a daylight saving time issue, but I can't figure out how.

    D 1 Reply Last reply
    0
    • O ormonds

      I have code which unzips a file over others, but first checks the date of a special file to make sure it is newer. The ModifiedTime of the file is found using:

      using (ZipFile zip = ZipFile.Read(OriginalFileName))
      try
      {
      ZipEntry z = zip["save_history.log"];
      NewFileAge = z.ModifiedTime;
      }
      catch......

      WinZip shows the date of the file as 26/02/2019 3:56 PM. Extraction confirms this. The value of NewFileAge in the code above is 26/02/2019 2:56 PM. The only references I can find to this refer to remote servers in different time zones. All these files are on one computer. Yes, it looks suspiciously like a daylight saving time issue, but I can't figure out how.

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Which ZIP library are you using? The one in the .NET Framework doesn't have a .Read method. Consult the documentation on that library. I'd be willing to bet the date/time you got back for the zip file entry is in UTC and you're comparing it to a local date/time.

      Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
      Dave Kreskowiak

      O 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Which ZIP library are you using? The one in the .NET Framework doesn't have a .Read method. Consult the documentation on that library. I'd be willing to bet the date/time you got back for the zip file entry is in UTC and you're comparing it to a local date/time.

        Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
        Dave Kreskowiak

        O Offline
        O Offline
        ormonds
        wrote on last edited by
        #3

        I'm using Ionic.Zip. You are right, I've converted to local time and that sorts it. Thanks.

        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