Questions tagged [date-utility]
17 questions
16
votes
4 answers
date - Can't Go Back More Than 115 Years or Can't Go 5879565 Years Into the Future
TZ=CEST, date (GNU coreutils) 8.32:
date -d "115 years ago"
Di 11. Aug 13:37:54 CET 1908
date -d "116 years ago"
date: invalid date ‘116 years ago’
Questions
Is it possible to go back more than 115 years into the Past or 5879565 years into the…
Pixelbog
- 540
- 2
- 17
4
votes
2 answers
how does the gnu coreutils `date` work?
I did not see any similar questions on this site. The manpage, while helpful in describing how to use date, did not have much background info. Even the info page (as prescribed in the manpage: info '(coreutils) date invocation'), had little more…
tniles
- 510
- 2
- 14
3
votes
2 answers
Why does `date` ignore TZ environment variable?
On Ubuntu 18.04, I have the following behavior of date:
$ date --version | head -n1
date (GNU coreutils) 8.28
$ date
Вт окт 8 13:18:18 MSK 2019
$ TZ=UTC date
Вт окт 8 10:18:23 UTC 2019
So far so good. But now I'm trying to do the same on Raspbian…
Ruslan
- 3,290
- 3
- 28
- 49
2
votes
1 answer
Get current date and time in standard ISO 8601 format on console in FreeBSD
I would like to get the current date-time conveniently on the console in standard ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ
For example: 2019-07-13T01:09:35Z
I know the date command displays the current date-time, but not in ISO 8601 format by default.…
Basil Bourque
- 1,475
- 1
- 16
- 29
1
vote
1 answer
Origin of date command default US format
date seems to have a very odd default format in the US locale: Thu Jul 9 17:00:00 EDT 2020 using a space-padded day-of-month and putting the (24-hour!) time in the middle, between the month+day and the year.
Is this some sort of standard? Where…
Adám
- 161
- 6
1
vote
0 answers
Timestamp retrived with `date -r file` does not fit the time order of commands
I was playing around with the command date to create timestamps and profile the execution of a script. I decided to set four of them, named t1 through t4. For t2 I created an empty file whose last modification time I could use at a later stage to…
XavierStuvw
- 1,089
- 6
- 17
- 40
1
vote
1 answer
Date string to epoch in bash
How can I get the epoch if I have a string in the following format?
1/30/2017 11:14:55 AM
The following does not work:
$ date -j '1/30/2017 11:14:55 AM' +'%m/%d/%Y %H:%M:%S'
date: illegal time format
Jim
- 9,750
- 15
- 57
- 84
1
vote
1 answer
Why is one of these date commands valid and the other not?
[user@mymachine folder]$ echo `date --date=tomorrow +%Y%m%d`
20160802
[user@mymachine folder]$ echo `date -d=tomorrow +%Y%m%d`
date: invalid date `=tomorrow'
I'm using Centos 5 if that makes any difference.
seanmus
- 141
- 5
1
vote
1 answer
how to log command start time and command end time in txt file using cygwin
I can save and view the cygwin console output (stdout and stderr) using the following command,
python command.py 2>&1 | tee -a outFile.txt// Note -a is for appending
since I have different commands and they take different time to execute. How can I…
Osaid
- 151
- 7
0
votes
0 answers
How can I get a BSD date command for Linux without compiling source code
I prefer the way the BSD date command allows returning arbitrary dates over the Linux date command. Is there a date program using BSD command line syntax and functionality for Linux?
Senior Geek
- 41
- 5
0
votes
2 answers
How to get date in format 2022-03-17T08:06:20.411493824Z
I can't seem to find any simple answers as to how to get the date 2022-03-17T08:06:20.411493824Z with a simple bash command. The current date and time that is.
I tried the following, but I'm not getting the excess digits:
DATE=$(date…
Karl Morrison
- 191
- 1
- 2
- 9
0
votes
2 answers
Using `date` with the `-d` / `--date=` option
I want to use date to calculate some future "alarm times" for the realtime clock on my Raspberry Pi. These "alarm times" will be used to "wake" the RPi.
The scheme I decided to use is as follows:
Immediately after booting, I get the current…
Seamus
- 2,522
- 1
- 16
- 31
0
votes
1 answer
Is there a way to restrict the application access to the system time in linux?
Is there a way to restrict the application access to the system time in linux?
I want to make the application launch as much as possible abstracted from the environment. If you can restrict access to devices/file system with permissions, it's not…
Tolsi
- 119
- 3
0
votes
3 answers
Cascading Date Manipulation and Precedence
echo 20171231 | xargs -i date -d "{} +1 day" | xargs -i date -d "{} -1 month"
**Fri Dec 1 00:00:00 PST 2017**
In this case, when date formatting commands are pipelined I am get Dec 1.
echo 20171231 | xargs -i date -d "{} +1day -1 month"
Sat Dec …
Murali Rao
- 155
- 6
0
votes
2 answers
FreeBSD date utility -r switch confuses me
I have a bash script which I need to convert from linux to FreeBSD, but I'm obviously too stupid to read the man page in a proper way.
The script has a line along:
date +%d -r "$file"
which works fine under linux, but just gives
date: illegal time…
s1lv3r
- 399
- 3
- 11