Skip to content

Loosing timezone information #103

@williamzeni99

Description

@williamzeni99

Hi!
I get a strange output from a doc file.

If I execute this command

williamzeni@pop-os:~$ exiftool -d '%Y:%m:%d %H:%M:%S%z' -j -ModifyDate "/home/williamzeni/Desktop/export-20241204144843/attachments/70be6d9775cb23874e03452972f494ecdcf0c2d92d7eb927820d50bbe7c5157c/CONTRATTO_POSCA_ZENI.doc"

[{
  "SourceFile": "/home/williamzeni/Desktop/export-20241204144843/attachments/70be6d9775cb23874e03452972f494ecdcf0c2d92d7eb927820d50bbe7c5157c/CONTRATTO_POSCA_ZENI.doc",
  "ModifyDate": "2024:09:18 08:52:00+0200"
}]

as you can see in ModifyDate I get the correct timezone offset. But it is not the same if I do the same command with python

from pathlib import Path
import exiftool
DATETIME_PARSE_FORMAT_EXIFTOOL = '%Y:%m:%d %H:%M:%S%z'

temp_file_path=Path("/home/williamzeni/Desktop/export-20241204144843/attachments/70be6d9775cb23874e03452972f494ecdcf0c2d92d7eb927820d50bbe7c5157c/CONTRATTO_POSCA_ZENI.doc")

with exiftool.ExifTool() as et:
    res = et.execute("-d", DATETIME_PARSE_FORMAT_EXIFTOOL, "-j", "-ModifyDate", str(temp_file_path))  # Execute the command and unpack the list


print(res)

I get this result:

[{
  "SourceFile": "/home/williamzeni/Desktop/export-20241204144843/attachments/70be6d9775cb23874e03452972f494ecdcf0c2d92d7eb927820d50bbe7c5157c/CONTRATTO_POSCA_ZENI.doc",
  "FlashPix:ModifyDate": "2024:09:18 08:52:00"
}]

as you can see the python library loses the timezone offset. It is happening just with this file, and not with others I tested since now (mostly pdfs).

For instance, same script but different file

[{
  "SourceFile": "/home/williamzeni/Documents/pyfet/tests/NGI3R5_241018175620393.pdf",
  "PDF:ModifyDate": "2024:10:18 17:56:20+02:00"
}]

What is happening?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions