The Matrix
The Matrix

Reputation: 1338

Java File.lastModified returned value changes if timezone changes?

Is the function lastModified from class File returning allways the same value even if the current device time is updated or even if the user changes the device timezone?

Upvotes: 3

Views: 588

Answers (2)

mawalker
mawalker

Reputation: 2070

Generally File.lastmodified is a static value (that can be updated, if you 'modify the file', obviously)

However, it is technically possible for 'root' on a linux system to modify the value https://askubuntu.com/questions/62492/how-can-i-change-the-date-modified-created-of-a-file (yes, I know... not 'Android', but Android runs the linux kernel and can probably do the same thing. if the person has rooted their phone.)

So it is 'technically' possible to change that value, but 'realistically' it won't change unless the file is changed/modified/etc.

Upvotes: 1

Tassos Bassoukos
Tassos Bassoukos

Reputation: 16142

File.lastModified corresponds to the last time the file that File points to was updated, and it's expressed in UTC milliseconds since the Epoch (1-1-1970). So, no, it does not change unless you modify the file.

Upvotes: 4

Related Questions