Skip to main content

Questions tagged [date]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
260 votes
12 answers
593k views

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 ...
Chockomonkey's user avatar
  • 2,743
32 votes
1 answer
4k views

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 (...
trycrmr's user avatar
  • 443
19 votes
3 answers
48k views

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 $...
qodeninja's user avatar
  • 2,783
17 votes
4 answers
39k views

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?
nitin's user avatar
  • 2,589
16 votes
3 answers
2k views

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 ...
Shirker's user avatar
  • 579
14 votes
2 answers
93k views

date: cannot set date: Operation not permitted [duplicate]

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 ...
Quentin McLoad's user avatar
13 votes
5 answers
20k views

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, ...
B14D3's user avatar
  • 5,278
13 votes
1 answer
20k views

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 ...
Skud's user avatar
  • 133
11 votes
3 answers
55k views

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 ...
yield's user avatar
  • 810
10 votes
23 answers
130k views

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 "...
Daniel Magliola's user avatar
8 votes
2 answers
16k views

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 ...
Adam's user avatar
  • 361
8 votes
2 answers
7k views

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/...
dandan's user avatar
  • 1,081
8 votes
3 answers
5k views

Alpine Linux timezone doesn't stick if tzdata is removed

This used to work to set the timezone. I have a container on Alpine 3.9.4 where it worked: RUN apk add --no-cache tzdata ENV TZ America/Chicago RUN apk del tzdata I'm now creating a Docker container ...
mbomb007's user avatar
  • 185
7 votes
1 answer
3k views

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"...
Daryl Spitzer's user avatar
7 votes
1 answer
371 views

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-%...
Victor Perov's user avatar
7 votes
1 answer
1k views

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: ...
Buella Gábor's user avatar
6 votes
7 answers
4k views

What format are DMARC dates?

I have a DMARC report that includes: <date_range> <begin>1500249600</begin> <end>1500335999</end> </date_range> How do I convert the dates to something human?
Greg Pagendam-Turner's user avatar
6 votes
2 answers
1k views

CentOS not considering daylight saving on timezone

In Brazil, this year, the president decided we should not have daylight saving. And because of that my Centos 8 server is with the time wrong, I mean, when I use date the time shown is wrong by 1 hour....
Samul's user avatar
  • 316
6 votes
4 answers
5k views

How to tell if a file is older than 30 minutes on AIX?

I'd like to write a shell script in ksh or bash which exits with 1 if a specific file is older than 30 minutes. (Last modification time is older than half hour). It would be easy on a Linux or a ...
csadam's user avatar
  • 188
5 votes
4 answers
24k views

Why is my "Last log on" date wrong?

I'm sitting here across the office from Bob, who is logged into the domain right now, working away. I pull up AD Admin Center and take a look at Bob's account and it tells me his last log on date is ...
blsub6's user avatar
  • 1,151
5 votes
3 answers
270 views

Is an ntpdate correction atomic?

I've got the following in /var/log/syslog, from yesterday (July 30th) Dec 16 22:54:05 omap ntpdate[432]: step time server 91.189.94.4 offset 12052648.821465 sec ntpdate 91.189.94.4 "corrected" my ...
Peter Woo's user avatar
5 votes
3 answers
4k views

date -d: what are the accepted strings?

I am using the "date" command to perform some simple date arithmetic. The "-d" option lets me do this, but the man pages are very unclear on what is valid data. What are all the accepted options, and ...
curious_george's user avatar
5 votes
5 answers
12k views

Cannot access client pc remotely due to time/date issue xp win2k3 environment -- REMOTE solution please

When I run psexec to the user desktop (xp pro) I get "There is a time and/or date difference between the client and the server." I also get "access denied" when I run the at \clientname time /...
Detritus Maximus's user avatar
5 votes
2 answers
7k views

Linux get UTC offset from current (or other) timezones on given date and time

In Chile the case is very particular as the days of daylight saving changes are different a year from another... Is there a function to get for given day at given UTC time the UTC offset? I saw on ...
Philippe Gachoud's user avatar
5 votes
2 answers
252 views

date +%s glitches

I have a strange issue I'm starting to troubleshoot and wondered if anyone would have any helpful tips. I have a cronjob executed every minute that executes a script and appends the output to a file ...
RnR's user avatar
  • 153
4 votes
5 answers
8k views

ntpdate not updating system time in XenServer VM

We have a Debian webserver that I am trying to use ntpdate to keep the time in sync. When I run ntpdate ntp0.cs.mu.oz.au I receive 16 Sep 10:55:36 ntpdate[21626]: step time server 128.250.36.2 ...
LukeR's user avatar
  • 3,156
4 votes
2 answers
2k views

Date and time zone on Linux

I ran the date command and it gave the following output: root@localhost:~$ date Thu Dec 30 14:19:47 UTC 2010 Then, I modified the date using date -s which gave the following output: root@localhost:~$ ...
LinuxPenseur's user avatar
4 votes
7 answers
51k views

How to create a yesterday date in a batch

copy \\server01\E$\LogFiles\IVR\bcR\??120428.* \\LBC\workgroup\cs\ftp\Team\bcR\ copy \\server02\E$\LogFiles\IVR\bcR\??120428.* \\LBC\workgroup\cs\ftp\Team\bcR\ copy \\server03\E$\LogFiles\IVR\bcR\??...
Joe's user avatar
  • 41
4 votes
3 answers
12k views

Convert SELinux log date format from Epoch to Normal

When SELinux logs an event to the audit log on my CentOS 6 system, it's logging it in epoch time which makes for a real hassle when trying to troubleshoot. Is there any way to make it log these events ...
Safado's user avatar
  • 4,786
4 votes
3 answers
17k views

How do I set current Unix time in milliseconds?

Possible Solution date --set="2011-12-07 01:20:15.962" && date --rfc-3339=ns Original Question I can get the date with milliseconds like so: date +"%S.%N" date --rfc-3339=ns According to ...
coolaj86's user avatar
  • 991
4 votes
2 answers
3k views

date keeps resetting

I have a virtual machine(VirtualBox) running Ubuntu server. When i issue date -s 2011-01-01 it changes the date, but after a few seconds, the date resets itself to the real time. I do not have any ...
quamis's user avatar
  • 362
4 votes
1 answer
2k views

Set date format in nginx autoindex HTML listing

The default date format in nginx autoindex HTML directory listings is 19-Jun-2019. Can I change it to ISO YYYY-MM-DD format instead?
Lassi's user avatar
  • 515
4 votes
2 answers
6k views

bash: convert date from to unix timestamp changes timestamp

Running the following command at the xen-servers (either DOM0 or DOMU) at $company gives me a negativ number, on every other system zero (0) (even in my cygwin). date -d "1970-01-01T00:00:00" "+%s" $...
killermoehre's user avatar
4 votes
3 answers
15k views

SFTP files not showing upload date as last modification time

Some of the files we receive on our Redhat server are showing date different from upload date as the last modification time. For us the modification time is important as we classify files depending on ...
nitin's user avatar
  • 2,589
4 votes
1 answer
176 views

date command displays different time

I have one centos 5.8 Linux server. I am experiencing a bit strange issue and figured out it is something with system time. When I check date command, outputs are really strange. Here is example: [...
mask8's user avatar
  • 169
3 votes
2 answers
4k views

Why is $ date still displaying EST when /etc/localtime is symlinked to /usr/share/zoneinfo/GMT?

I'm having a problem setting the date on my server... $ ls -la /etc | grep localtime lrwxrwxrwx 1 root root 23 Mar 6 12:07 /etc/localtime -> /usr/share/zoneinfo/GMT For some reason, although ...
Tom's user avatar
  • 741
3 votes
1 answer
1k views

Linux date translation to different time zone

The Linux server is hosted in EST timezone. But I want to translate the output of date command to IST(Indian Standard time +5:30 hrs) format and use it in a shell script. Is there any option available ...
nitin's user avatar
  • 2,589
3 votes
1 answer
5k views

jq sort by date (iso 8601)

I try to sort json by date (field CreationTimeUTC) in iso 8601 format with jq 1.5. I found this post, but that return : 'Cannot index boolean with string "CreationTimeUTC"' jq '.Entities....
Isopote42's user avatar
  • 157
2 votes
2 answers
7k views

Bash scripting: detect first day of month

I wrote three bash files: incremental_backup full_backup execution Now I want another bash script do the following : if (date is the start of month 1/-/----) then invoke `full_back_up` ...
Mohammad AL-Rawabdeh's user avatar
2 votes
3 answers
260 views

Changing linux date with current time

I am running sudo date +%m/%d/%Y -s 7/14/2010 command to change date. It changes fine except I want it to pick up the current time as well, and not start the time from 00:00:00 on 7/14/2010.
gAMBOOKa's user avatar
  • 999
2 votes
1 answer
4k views

Set up a permanent system date

I need to set up a permanent system date in a Linux test server for time-sensitive software which needs this time loop (Groundhog day's style) or bending time (Hiro's ones), you name it. I tried it ...
Dario Castañé's user avatar
2 votes
3 answers
4k views

Creating a RFC 1123 compliant date for HTTP header creation on the CLI

I'm trying to create a HTTP 1/1 compliant date header using standard unix date(1) in order to post this to a RESTful server using curl or similar. Any ideas what format to pass to date(1) to get this ...
Brad's user avatar
  • 289
2 votes
2 answers
196 views

Display nth instance of grepped pattern

So here's my problem. I have an issue with a .csv file (Current.csv) in that there are commas randomly place throughout the data, so awk-ing the file doesn't give me constant column numbers for a ...
user avatar
2 votes
2 answers
2k views

Transfer files older than N days with WinSCP

How to transfer files with WinSCP that are older than N days? It seems there is no such option inside. But could it be done with scripting/cmd mix?
Konstantin Petrukhnov's user avatar
2 votes
1 answer
4k views

filtering event logs with specific TIME range of ANY day

How can I query windows server events between two times of any day? I have tried with PowerShell... Get-EventLog -Logname xxxx -After 04:00:00 -Before 04:00:30 ...but just returns today's events
jreinap's user avatar
  • 23
2 votes
1 answer
794 views

What is changing my Windows Server's date?

At my organisation we have a number of virtual machines on ESXi hosts in a number of sites. For the past few months, around once or twice a week one virtual machine, seemingly at random, will update ...
Mayzed's user avatar
  • 21
2 votes
1 answer
775 views

Centos 6 Timezone Wrong

I am trying to set my Centos 6 VPS to GMT timezone. I tried a sudo ln -s /usr/share/zoneinfo/GMT /etc/localtime Which works fine. However when I run date it returns: Tue Oct 4 05:09:32 GMT 2016 ...
Shiv's user avatar
  • 199
2 votes
1 answer
2k views

How to start tomcat with faketime within a docker container?

I use docker to deploy a Java web application in tomcat. For testing purposes, I want to force the system date to a specific value. With Docker it is not possible to change the container date without ...
jsebfranck's user avatar
2 votes
1 answer
608 views

Users changing date/time from BIOS

We have around 350 Windows XP PC and a Windows 2008 R2 Server. The problem is that some users are changing the date/time from BIOS and the next user who would try to log-in on that PC would get the ...
user avatar
2 votes
0 answers
787 views

Journalctl seems to be ignoring since and until

I'm trying to get the logs of a problem that's been happening for over a week by this point. I'm trying to use journalctl to print the logs but it doesn't seem to give me anything more or less than ...
Thomas's user avatar
  • 225