You can simply
touch the file or provide any time and date in past or future:
~$ touch /sdcard/test_file ~# debugfs -R 'stat media/0/test_file' /dev/block/bootdevice/by-name/userdata | grep crtime: crtime: 0x5c926e0d:2d61b810 -- Wed Mar 20 21:45:01 2019 ~$ touch -d '2009-2-13 14:32:55' /sdcard/test_file ~$ stat /sdcard/test_file (...) Access: 2009-02-13 14:32:55.000000000 +0000 Modify: 2009-02-13 14:32:55.000000000 +0000 Change: 2019-03-20 21:45:38.067021025 +0000 Birth: -
Some file explorers like MiXplorer also have options to change Modified Time.
You don’t need super user privileges to change
mtime. Only the file should be writeable by your user ID (app in case of Android).
touch uses utimensat to update time of access (
atime) and modification (
mtime) provided that filesystem supports the timestamps be saved in inode along with file’s data.
Birth/creation time (
crtime) – a part of extended file status which requires at least 256bytes inode size – is not standardized, thus rarely supported by filesystems. In above commands
debugfs is used with root privileges to get creation time of file on
ext4 because some
stat binaries aren’t updated to use statx yet (requires at least Linux Kernel 4.11), so
btime is empty.
btime and change time (
ctime; inode/metadata modification time) are supposed to be handled by system, not simply changeable by user.
Since Android is based on Linux, it inherits the concept of inode and timestamps from UNIX world. Common Linux filesystems like
f2fs support timestamps, including the emulated filesystems used by Android on SD cards. Other OS and filesystems have similar concept with slightly different terminologies. E.g. on Windows’
Entry Modified time is very identical to UNIX’s