Questions tagged [date-utility]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
62 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 ...
user avatar
0 votes
1 answer
72 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 ...
user avatar
  • 151
0 votes
0 answers
17 views

How to sanitize user input timezone (TZ)?

In my POSIX sh script, I receive a user input timezone (=TZ) with an option. However, I want to throw errors when the tz is not legit (not found in the system). For example, TZ='CETX' date '+%T' ...
user avatar
0 votes
2 answers
164 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 ...
user avatar
  • 2,196
2 votes
1 answer
1k 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 ...
user avatar
  • 2,969
2 votes
1 answer
2k 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 ...
user avatar
1 vote
0 answers
22 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 ...
user avatar
  • 1,007
0 votes
1 answer
331 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 ...
user avatar
  • 119
-1 votes
1 answer
617 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 ...
user avatar
  • 151
0 votes
3 answers
119 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 ...
user avatar
1 vote
1 answer
5k 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 ...
user avatar
  • 8,890
1 vote
1 answer
57 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 ...
user avatar
  • 141
3 votes
2 answers
1k 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 '(...
user avatar
  • 500
0 votes
2 answers
281 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 ...
user avatar
  • 399
0 votes
1 answer
75 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' ...
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 ...
user avatar
  • 151