LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   date -d @x on old date (5.2.1) (https://www.linuxquestions.org/questions/linux-software-2/date-d-%40x-on-old-date-5-2-1-a-753318/)

eantoranz 09-07-2009 09:46 AM

date -d @x on old date (5.2.1)
 
Hello!

I want to use date but I must be able to tell it what date to process in GNU format. In kubuntu 9.04 (date 6.10) I can do:

Code:

$ date -d @1
mié dic 31 19:00:01 COT 1969

But on the old version it complains that @1 is not a valid date format. How can I use it with the old version?

eantoranz 09-07-2009 09:59 AM

Nevermind. We just saw that you can pass --date='1 week ago', for example... and that will do.

colucix 09-07-2009 10:14 AM

Quote:

Originally Posted by eantoranz (Post 3673089)
Nevermind. We just saw that you can pass --date='1 week ago', for example... and that will do.

You can also compute dates relative to a specific date, not just today:
Code:

$ date -d "20090725 1 week ago"
Sat Jul 18 00:00:00 CEST 2009

The info page of the date command has a complete explanation of all the possible date formats.
Code:

info --index-search="Date input formats" date


All times are GMT -5. The time now is 10:06 AM.