Questions tagged [date-utility]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
16 votes
4 answers
3k views

date - Can't Go Back More Than 115 Years or Can't Go 5879565 Years Into the Future

TimeZone = 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 ...
Pixelbog's user avatar
  • 669
0 votes
0 answers
198 views

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's user avatar
0 votes
2 answers
677 views

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 ...
Karl Morrison's user avatar
1 vote
1 answer
473 views

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 ...
Adám's user avatar
  • 161
0 votes
2 answers
727 views

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 ...
Seamus's user avatar
  • 2,787
3 votes
2 answers
3k views

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 ...
Ruslan's user avatar
  • 3,310
2 votes
1 answer
4k views

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 ...
Basil Bourque's user avatar
1 vote
0 answers
23 views

Timestamp retrived with `date -r file` does not fit the time order of commands [duplicate]

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 ...
XavierStuvw's user avatar
  • 1,109
0 votes
1 answer
508 views

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 ...
Tolsi's user avatar
  • 119
-1 votes
1 answer
1k views

How can a linux process's date and time be updated without restarting? [closed]

I have a requirement where date and timestamp of a server has to be changed frequently to desired value and associated processes (Weblogic server/Java Virtual Machine Process and a script) have to ...
Dexter's user avatar
  • 161
0 votes
3 answers
158 views

Cascading Date Manipulation and Precedence [duplicate]

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 ...
Murali Rao's user avatar
1 vote
1 answer
6k views

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 ...
Jim's user avatar
  • 9,900
1 vote
1 answer
58 views

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 ...
seanmus's user avatar
  • 141
4 votes
2 answers
2k views

how does the gnu coreutils `date` work? [closed]

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 '(...
tniles's user avatar
  • 510
0 votes
2 answers
319 views

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 ...
s1lv3r's user avatar
  • 399
0 votes
1 answer
85 views

Add n days to a date token

My issue as follows: consider I have a token $d=20140607 and I want to add 7 days to it. I tried date -d "$d+7 days" but it is not working. It throws this error date: invalid date `20160407+7days' ...
Hasain's user avatar
  • 1
1 vote
1 answer
2k views

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 ...
Osaid's user avatar
  • 151