Questions tagged [date]
149 questions
243
votes
11 answers
Docker Container time & timezone (will not reflect changes)
Where do Docker containers get their time information? I've created some containers from the basic ubuntu:trusty image, and when I run it and request 'date', I get UTC time.
For awhile I got around this by doing the following in my Dockerfile:
RUN…
![](../../users/profiles/278285.webp)
Chockomonkey
- 2,573
- 2
- 10
- 10
32
votes
1 answer
Why is the year in this ISO timestamp not 2019?
For a simple app I'm using to test a devops pipeline I'm outputting the start time of a build to the homepage. On my development machine the year of the ISO-8601 timestamp I expect, 2019, is printed (specifically, "2019-09-12T20:11:00.000Z"). When…
![](../../users/profiles/443716.webp)
trycrmr
- 443
- 4
- 8
18
votes
3 answers
How do you set a DATE variable to use in a log for crontab output?
I was playing aroudn with some variations of date like
DATE = $(date)
but that didnt work either
crontab -e
CRONLOG=/tmp/log/crontab.log
DATEVAR=`date +20\%y\%m\%d_\%H\%M\%S`
* * * * * echo $DATEVAR >> /tmp/log/crontab.log
*/2 * * * * echo…
![](../../users/profiles/21343.webp)
qodeninja
- 2,723
- 10
- 31
- 33
16
votes
3 answers
Why is there a difference with Unix date between 2 and 3 months
How is this possible and how do I deal with it? I'm making backup script that is dependent on Unix date and have discovered an interesting bug:
[root@web000c zfs_test]# date +%y-%m-%d --date='2 months ago'
14-04-01
[root@web000c zfs_test]# date…
![](../../users/profiles/195529.webp)
Shirker
- 579
- 1
- 5
- 18
15
votes
4 answers
Calculate Days Since 1/1/1970
How can you calculate the number of days since 1/1/1970? This is for updating the shadowLastChange attribute on OpenLDAP.
Is there a way to do this using the linux date command?
![](../../users/profiles/8888.webp)
nitins
- 2,527
- 15
- 42
- 65
14
votes
2 answers
date: cannot set date: Operation not permitted
I have received an interesting problem during I tried to set my Server time either with NTD or manually using date command.
First of all I have tried to use NTD. I have succesfully installed the latest version of NTD, started it. After that I have…
![](../../users/profiles/174317.webp)
Quentin McLoad
- 149
- 1
- 2
- 4
13
votes
1 answer
How do I make cron run every other Sunday on the OTHER Sunday?
I have a cron job that runs at 0 0 * * 0/2 -- i.e. every other Sunday. It just ran now, for instance. However, I want it to run on the other Sundays -- next Sunday, rather than this one. Another way of putting it: I presume it's running on…
![](../../users/profiles/171489.webp)
Skud
- 133
- 1
- 1
- 6
11
votes
5 answers
How to determine number of week of the month
On the Linux CLI, is there a way to get the number of the week of the month? Maybe there is another way to get this with one simple (like date) command? Let's say that day 1 to 7 is the first week, day 8 to 14 is the second week, and so on.
![](../../users/profiles/71114.webp)
B14D3
- 5,110
- 13
- 58
- 82
10
votes
23 answers
Finding day of week in batch file? (Windows Server 2008)
I have a process I run from a batch file, and i only want to run it on a certain day of the week.
Is it possible to get the day of week?
All the example I found, somehow rely on "date /t" to return "Friday, 12/11/2009", however, in my machine, "date…
![](../../users/profiles/1168.webp)
Daniel Magliola
- 1,402
- 9
- 20
- 33
10
votes
3 answers
ansible manipulate file with a date format
In ansible, I would like to manipulate files/directories/archive that are composed or to composed like this:
How would I do that. It seem Ansible is not able to handler that. (I doubt).
So, what I do wrong ?
Ex:
- name: create file with a date in…
![](../../users/profiles/98608.webp)
yield
- 731
- 1
- 8
- 24
8
votes
2 answers
Red hat Linux + TIME ZONE CONFIGURATION + details from clock file
In order to configure the Time Zone on red hat Linux machine ( version 5 and 6 )
need to configure
the file:
/etc/sysconfig/clock
And create a symbolic link between
/etc/localtime to /usr/share/zoneinfo/America/New_York
but /etc/sysconfig/clock…
![](../../users/profiles/346089.webp)
dandan
- 1,021
- 4
- 13
- 21
8
votes
2 answers
How can I get logrotate dateext to reflect the log date rather than the rotation date?
My Apache logrotate config looks like this:
/var/log/http/*log {
monthly
dateext
dateformat .%Y.%m
[... rest stripped for brevity ...]
}
This works great, except that the date on the rotated filename is one period later than the…
![](../../users/profiles/139241.webp)
Adam
- 341
- 1
- 3
- 9
7
votes
1 answer
Ubuntu 18.04 strange behaviour of date with --date option
I've found strange behaviour of date program in Ubuntu 18.04.
So, I consider date should work with --date option and correctly process +N minutes:
date --date "2019-01-01 13:43:32 +1 minutes" "+%Y-%m-%d %H:%M:%S"
But, in Ubuntu 16.04 I will…
![](../../users/profiles/206117.webp)
Victor Perov
- 255
- 2
- 9
7
votes
1 answer
Time too quick in debian, 72 minutes pass in system date in one real world second
Having trouble with system date/time in GNU/Linux/Debian:
Time goes too fast for date, time, cron.
The sleep command works fine, file modification times are correct.
The issue explained via commands:
$ date
Mon Sep 12 05:27:46 CEST 2011
$ time…
![](../../users/profiles/90266.webp)
Buella Gábor
- 171
- 4
7
votes
1 answer
Is it possible to set the date on a Linux machine to the year 2040?
I need to be able to set the date on Ubuntu (8.04.4 LTS) to the year 2040 (to test something that isn't relevant to this question). Is that possible?
I can run:
$ sudo date -s "15 JAN 2038 18:00:00"
Fri Jan 15 18:00:00 PST 2038
...but:
$ sudo date…
![](../../users/profiles/20205.webp)
Daryl Spitzer
- 2,946
- 9
- 33
- 40