LastModificationTime and different time zones

  • I was just looking through the source code of Keepass (because I'm using it in Keepass2Android) and as far as I can tell, the LastModificationTime property of PwEntry (type DateTime) stores local times. The Touch method sets this property to DateTime.Now, which, according to, uses the local time.

    According to, "A developer is responsible for keeping track of time-zone information associated with a DateTime value via some external mechanism". Does any such mechanism exist in Keepass?

    This is important if changes from different devices are synchronized in order to keep the latest changes. Am I missing something?

  • Dominik Reichl
    Dominik Reichl

    In KDBX files, times are always stored in UTC.

    While KeePass is running, it uses local times (i.e. when KeePass opens a KDBX file, it loads all times in UTC and converts them to local, and when saving it converts them back from local to UTC).

    Best regards,

  • ah, thanks for pointing that out!
    This means that the serializing code is responsible for this (which makes sense). So the next question is for Alex Vallat: I think this conversion is not performed in the Kdbp serializing code, right?

  • AlexVallat

    Yes, thanks for letting me know, I was just serialising the times exactly as they were stored in memory. I've fixed this now, in KdbpFile v0.3 and sent you a pull request for the same change to the implementation in Keepass2Android.