I am struggling to understand how to set a variable to be a particular timestamp. given dt which is the current date, say 2016-05-11 17:10:00, i want to create another date variable that is (roughly) 9 hours after dt, and on the exact hour, i.e., 2016-05-12 02:00:00. In other words, I would set the new date to be 9 hours
Tag: date
Preserve timestamp when editing file
I want to preserve the timestamp of the files I’m editing in a for loop The issue is I need to get a formatted date string from the file so that I can do touch -r to revert the files date back once the loop has completed. stat is not giving the me the format I need. Required Format: YYMMDDhhmm
change date/time using python in linux
I tried using date command to change the system time in debian linux: os.system(“echo passwd | “sudo date -s “Thu Aug 9 21:31:26 UTC 2012”) and I set the python file permission to 777 and also chown as root. But it does not work and says date: cannot set date: Operation not permitted. Any Ideas? Thanks Answer Sudo doesn’t take
How to find newest files with a certain name?
Suppose I have a directory with many files of the same name in subdirectories (for example, comes up when keeping BibTeX files for multiple academic papers). What’s the best way to find the newest version of a file with a given name? I’ve come up with the following command which lists all the files named someFile along with their dates,