date komutu

Belirli tarihten istenilen gün sayısı kadar sonrası: date -d '2016-10-31 + 26 days' +"%Y"-"%m"-"%d"

Daha fazla örnek:

To print the date of the day before yesterday.

$ date –date=’2 days ago’ To rename a file with the current date and time.

$ STAMPME=$HOME/sample_$(date +%Y%m%d-%H%M).txt $ mv $HOME/sample.txt $STAMPME To print the date of the day three months and one day hence.

$ date –date=’3 months 1 day’ To print the day of year of Christmas in the current year.

$ date –date=’25 Dec’ +%j To print the current full month name and the day of the month.

$ date ‘+%B %d’ To print a date without the leading zero for one-digit days of the month, you can use the (GNU extension) ‘-‘ modifier to suppress the padding altogether.

$ date -d=1may ‘+%B %-d’ To print the current date and time in the format required by many non-GNU versions of ‘date’ when setting the system clock.

$ date +%m%d%H%M%Y.%S To set the system date and time.

$ date –set=”2016-1-20 11:59 AM” To set the system clock forward by two minutes.

$ date –set=’+2 minutes’ To print the date in the format specified by RFC-822 (day month year hh:mm:ss zzz).

$ date –rfc To convert a date string to the number of seconds since the epoch 1970-01-01 00:00:00 GMT

$ date –date=’2000-01-01 00:00:01 UTC +5 hours’ +%s 946706400 To convert a date string to the number of seconds since the epoch 1970-01-01 00:00:00 local zone

$ date –date=’2000-01-01 00:00:01′ +%s 946684800 To convert a number of seconds back to a more readable date

$ date -d '1970-01-01 946684800 sec' +"%Y-%m-%d %T %z" 2000-01-01 00:00:00 +0000

Comments are closed.