My Board
Specify Date and Time as String with Linux Touch Command - Printable Version

+- My Board (https://ellohost.com/forum)
+-- Forum: Tutoriel EN (https://ellohost.com/forum/forumdisplay.php?fid=8)
+--- Forum: Others (https://ellohost.com/forum/forumdisplay.php?fid=20)
+--- Thread: Specify Date and Time as String with Linux Touch Command (/showthread.php?tid=756)



Specify Date and Time as String with Linux Touch Command - aaron - 09-08-2023



    Specify Date and Time as String with Linux Touch Command

   

You can also specify the date and time as a string by using the -d option with the Linux touch command. The following Linux touch command example sets the date to the 8th of March, and the time is automatically set to 00:00:

   
touch -d '8 Mar' file_name.txt
   

Instead of specifying the date as a string, you can select the time as one. In that case, the date will be set to the current date automatically:

   
touch -d '20:10' file_name.txt