Questions tagged [date]

the "date" tag is used to classify questions about date/calendar/time manipulation, visualisation, conversion... on Unix-like systems.

102 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4 votes
0 answers
654 views

Faketime lib on Mac not always works

Installed libfaketime with brew, latest version 0.9.7, then did following steps as described in README.OSX: export DYLD_FORCE_FLAT_NAMESPACE=1 export DYLD_INSERT_LIBRARIES=/usr/local/Cellar/...
Alexander Kim's user avatar
3 votes
0 answers
55 views

How can I format the date and time in accordance with ISO 8601 / RFC 3339 using systemd?

How can I configure the environment of a systemd based Linux system to display the date system-wide in the format yyyy-mm-dd? This date format adheres to the specifications defined ISO 8601 and RFC ...
Jonas Stein's user avatar
  • 3,938
3 votes
2 answers
2k views

Make date change permanent in EC2

How can I manually set date and time to future in EC2 instance and make it permanent, so it won't reset after reboot ? I can change date using this command: $ sudo timedatectl set-time "2017-12-09 ...
Michal Przybylowicz's user avatar
3 votes
0 answers
380 views

ISO8601 time everywhere?

I would like to have my dates and times shown in ISO8601. I have been unable to find a locale which supports that and which does not cause other programs (e.g. perl) to go berserk. Which locale ...
Ole Tange's user avatar
  • 33.8k
3 votes
1 answer
3k views

I'm trying to compile alsa-driver-RTv5.18 but get date-time error for gcc 4.9.2

/home/user/Downloads/Rt-Linux-HDaudio-5.18/alsa-driver-RTv5.18/alsa/acore/info.c:1065:22: error: macro "__DATE__" might prevent reproducible builds [-Werror=date-time] "Compiled on " __DATE__ " for ...
Vyacheslav's user avatar
2 votes
0 answers
76 views

Watch command -d=cumulative gives unexpected behavior with --color

This script gives the expected behavior, highlighting the parts of the date that change: watch -d=cumulative date However this script highlights the entirety of the text instead of just the things ...
Jake's user avatar
  • 21
2 votes
0 answers
66 views

Making the locale time format more compact

dmesg -T gives human readable time format, and I want to make it more compact, from this [Пт мар 12 09:18:54 2021] wlan0: associated to this [12.03.21 09:18:54] wlan0: associated I'm using ru_RU.UTF-...
5007060's user avatar
  • 21
2 votes
1 answer
79 views

debian v10 locale interpretation in date command

I've noticed that after upgrade from Debian 8 to Debian 10, the date command produces different (12H) format though the same LC_TIME is set on both. It can also be easily demonstrated using LC_TIME in ...
Chris's user avatar
  • 3,691
2 votes
0 answers
131 views

2038 problem behaving differently in different time zone

I am working on 32 bit linux and i understand 2038 problem https://en.wikipedia.org/wiki/Year_2038_problem Anyhow , when i try to use date command to set time beyond 03:14:07 UTC on 19 January 2038 ...
sroy's user avatar
  • 21
2 votes
0 answers
638 views

How to change date format in Thunderbird

The date format in the date column (inbox folder) is as follow: dd-mm-yy hh:mm. The problem is that when displaying emails from days or months represented by a single digit it messes up the alignment ...
potato's user avatar
  • 413
2 votes
2 answers
262 views

Syntax for using epoch times in a calculation with the `--date=STRING` usage of the `date` command

I have a time represented as seconds since 1970-01-01 00:00:00 UTC, like 1524884843. I want to get the time, say, 1 month from the above specified time. Normally if I want to get the time 1 month ...
bigjosh's user avatar
  • 589
2 votes
0 answers
1k views

Getting a range of lines between timestamps from /var/log/messages

I want to get all lines between two timestamps from /var/log/messages. I only have start time which I provide to my script as input. The script then should get me all the lines till next day as output....
pragmatic's user avatar
  • 131
2 votes
0 answers
65 views

One-liner to convert and adjust a specified time in FreeBSD

It's easy to accept a date in a specified but non-standard format (date -j -f "EXISTING_DATE_FORMAT" "EXISTING_DATE" "OUTPUT_FORMAT"), and easy to adjust a date with the same command (date -j -v+1y "...
Stilez's user avatar
  • 1,221
2 votes
0 answers
2k views

"export TZ=`date +%Z`" leads to confusing output of "date"

I recently noticed the following (strange) behavior: user@pc:~$ date Mi 21. Jun 12:03:10 CEST 2017 user@pc:~$ date +%Z CEST user@pc:~$ export TZ=`date +%Z` user@pc:~$ date Mi 21. Jun 10:03:30 ...
daniel.heydebreck's user avatar
2 votes
0 answers
8k views

How do I set the correct time on Centos 7?

I have the minimal install of Centos 7 on my PC (not virtual box). I have spent the last few hours trying to figure out how to set up the correct time. I am still fast by one hour. After spending ...
Murchak's user avatar
  • 21
1 vote
0 answers
83 views

Linux UTM VM Hardware Clock is Incorrect

My machine natively runs MacOS Ventura 13.3.1. I am using UTM to run 5.14.8-arch1-1. I am on PST. The output of sudo hwclock --verbose is as follows: hwclock from util-linux 2.37.2 ... Hardware clock ...
user129393192's user avatar
1 vote
0 answers
658 views

Failed to start Network Time Synchronization

Can anyone let me know why I am facing Failed to start Network Time Synchronization at the kernel logs? When I run timedatectl command I get the message Failed to query server: Connection timed out ...
Sukanya U's user avatar
1 vote
1 answer
199 views

zdump and date do not show the same daylight saving information

I am using my localtime set to be Israel. I updated the system clock and hardware clock, and using zdump I get: ~# zdump /usr/share/zoneinfo/Israel /usr/share/zoneinfo/Israel Wed Apr 20 16:11:36 2022 ...
Investing TS's user avatar
1 vote
1 answer
56 views

Unix script to process data by comparing it to same key records

I have a problem in which Input file has Effective date and End date records. First 6 fields are the keys (12345A). We need to update End date(18 position) based on effective(8 position) date of the ...
Shubham Sharma's user avatar
1 vote
0 answers
234 views

systemd dbus service continuously updates system time

I am trying to set my centos vm's date to 1 months prior date for some license validation, for that I have disabled systemd-timesyncd and ntpd service but still after setting the time to -32 days the ...
Aamir Shaikh's user avatar
1 vote
0 answers
50 views

Call script in locale definition

I am following the answer in https://askubuntu.com/a/162714/146591 to generate a custom locale on my system. Many of the fields that can be configured in a locale are input for the date utility (https:...
Hidde's user avatar
  • 111
1 vote
1 answer
401 views

How date command keep tracking time

I got a weird scenario in which the date of my computer is getting the wrong time (and he keeps fixing the time but still keep repeating this issue) let me share with you an example who make this much ...
ShmuelCohen's user avatar
1 vote
2 answers
587 views

Find the age of the oldest file in one line

I tried stat -c %Y ./* 2>/dev/null | awk -v d="$(date +%s)" 'BEGIN {m=d} $0 < m {m = $0} END {print d - m}' to find the age of the oldest file in the current directory, and I get a number in ...
Luka's user avatar
  • 11
1 vote
0 answers
132 views

Secure way to update Date & Time of a Linux Embedded Device

I have a Linux (4.9.171) machine running on ARM Cortex-A processor. The system has internet connection and talks to my server over SSL. At the first boot, I can configure the date and time to it. ...
abhiarora's user avatar
  • 121
1 vote
0 answers
135 views

How to determine if file has been modified in the last x seconds

I want to determine if a file has been modified in the last x seconds on MacOS or Debian etc. is_file_older_than() { seconds="$1" file="$2" echo "The file $file" modified_secs="$(date -r "$...
Alexander Mills's user avatar
1 vote
0 answers
115 views

Change timezone of mov files

I forgot to set the correct timezone in my camera during a vacation and now the times are all off by 7 hours. To correct this for the image files I used exiv2 -a -07 adjust *.JPG which changes the ...
user1583209's user avatar
1 vote
1 answer
136 views

Calculate difference in numbers and save in colon-separated time format with bash script

I have a tab-separated file, e.g., 0018803 01 1710 2050 002571 0018951 01 1934 2525 003277 0019362 02 2404 2415 002829 0019392 01 2621 2820 001924 0019542 01 ...
Aditya's user avatar
  • 11
1 vote
2 answers
879 views

Printing a dynamic list of month days vertically

I need to write few line in a code that I use in my study, and I really gave up! currently, i can list the days of a month and the equivalent day number but I can't link this to the system clock so it ...
user avatar
1 vote
1 answer
763 views

Permanently adjusting RHEL 6 timezone

We have a collection of cards running RHEL 6. We would like them to boot such that their timezones are Zulu (UTS, GMT, GMT-0). I have read and tried many of the suggestions out there that supposedly ...
m1rjj00's user avatar
  • 11
1 vote
0 answers
290 views

rtcwake being set one day ahead of intended time

I am trying to use this command to wake up my computer 5 seconds from now: sudo rtcwake -m no -s 5 The problem I am having is that the time to wake my computer is set 5 seconds ahead of current time ...
Nick Farley's user avatar
1 vote
0 answers
401 views

Compare file dates from two directories

I have two directories with files with the same name. Basically I want to replace dir1/file.txt with dir2/file.txt if the creation date of dir1/file.txt is more recent. But i think I'm missing ...
LucaP's user avatar
  • 143
1 vote
0 answers
133 views

How to track leap second change after it happened?

I had applied a patch from Redhat on this machine to automatically correct the leap second change by inserting an extra second at the time of leap second change. Now, I want to see its effect. Of ...
Vinod's user avatar
  • 131
1 vote
0 answers
96 views

Cron running tasks at second 26?

I've many vps with the same cron task sending data with curl every minute, e.g. date command output. So I'm receiving datetime from every vps and I just realized that one of them is running the cron ...
Mc Kernel's user avatar
  • 521
1 vote
1 answer
4k views

view IPs from apache access.log for date period

I have seen someone use this command -- and it works where it pulls back all the IPS in a list/group: cat access.* | awk '{ print $1 }' | sort | uniq -c | sort -n However, I want to choose the past ...
WMK83's user avatar
  • 65
1 vote
0 answers
309 views

How to change the date format in the LXDM login/greeting screen (LXDE)

I found a number of resources to change the system (Archlinux 2016-03-01) date format, amongst others one to create a new format from an existing locale file. I then modifed /etc/environment and ...
asoundmove's user avatar
  • 2,465
1 vote
0 answers
98 views

date/time setting does not work after unplugging power adapter or sudden power cut

For some reason, I want to configure the date/time in my Linux (CentOS 6.5) to be different from the REAL date/time, but the setting won't work if I turn my computer(desktop not laptop if this matters,...
CodyChan's user avatar
  • 914
1 vote
0 answers
2k views

Changing the date format of auth.log

I was looking to change the date format in which auth.log logs information. I could not find a way to do it. Is there a method to do this? My system uses rsyslog.
Devil's user avatar
  • 173
0 votes
0 answers
357 views

Format date to another date format in bash

I am retrieving the following dates from a database: 2022-04-12-08.22.28.940722 2018-10-30-10.28.10.112309 2022-04-07-14.13.19.426219 In my bash script I am writing them to a file (where the date is ...
Niek Jonkman's user avatar
0 votes
1 answer
176 views

terminal timer with end time given through bash

so I had the idea of making a bash function that takes in a time in hh:mm:ss (24 hour format) and makes a timer till that time kinda like a one time alarm while also showing how much time is left I ...
stacking and exchanging woohoo's user avatar
0 votes
0 answers
23 views

Copying folders within archive and preserve metadata

Im using 7zip in ubuntu 22.04 and Im using this command 7z l -slt "/media/azeem/368A-5AA7/airdroid test folder made with winzip.zip" airdroid test folder made with winzip.zip file is what I ...
anmac1789's user avatar
0 votes
1 answer
448 views

How to show seconds in time format of KDE lock screen?

I am using Russian locale and I use KDE. When locking screen with Meta + L, you see the current date and time on it. The time is in format "12:34". I want to change it to "12:34:56"...
Ashark's user avatar
  • 769
0 votes
2 answers
515 views

Issue with timedatectl

Hi can any help me how timedatctl works my understanding are if system clock sysnc with NTP serivce through internet system time will be updated to current date and time. If system clock sync with ...
Sukanya U's user avatar
0 votes
0 answers
85 views

change date languge

I'm working on Reh Hat linux server,I want to change date language to "French". when I run the command date I get Thu Aug 25 13:30:25 CEST 2022 as you can see, the language used is English ...
user3093583's user avatar
0 votes
1 answer
194 views

Add microseconds to date, displayed down to seconds (from Oracle trace file...)

Oracle 10046 trace files contain data like *** SESSION ID:(501.50681) 2022-08-08T13:27:08.567565+02:00 *** CLIENT ID:() 2022-08-08T13:27:08.567584+02:00 ... WAIT #0: nam='SQL*Net message to client' ...
Seb's user avatar
  • 1
0 votes
2 answers
98 views

Select a microservice with awk and create a file with the current date and version

I would like to see the logs for a microservice with the latest version and send its content to a file according to the date. user@MacBook-Pro ~ % kubectl -n bci-api get pods | grep ms-example-...
joseluisbz's user avatar
0 votes
0 answers
230 views

Find out who changed the date on linux?

I'm currently trying to change the date on my Linux machine: date +%s -s @1637142120 Somehow, the date gets resented after some seconds. Is there any way to find out which program / system is ...
Mr. Jo's user avatar
  • 203
0 votes
0 answers
789 views

How to filter for only unique errors in multiple logs using grep?

I am trying to use the following pattern on Ubuntu: grep -Eri "warning|error|critical|severe|fatal" --color=auto to find relevant errors in many different .log files recursively in /var/log ...
pythonInRelay's user avatar
0 votes
1 answer
169 views

Bash-Script: stop/abord if is last Sunday in March or October?

How can I stop/abort a bash-script when: is last Sunday in March? OR is last Sunday in October? Both should be checked here and if so the bash script should be stopped/aborted. Thanks in advance. ...
user avatar
0 votes
1 answer
40 views

Does change of date or inconsistency between date and hwclock affect to ipv4 (inet addr) in ifconfig in linux?

I have trouble that inet addr(ipv4) of eth0 disappears and eth0 interface becomes unavailable. I'v not waited for refresh but I thought it would not restore itself. I guess that It Occurs When I ...
user avatar
0 votes
1 answer
34 views

GNU date command jumbling day and year when giving the proper format specifier

I have come across this weird behaviour of GNU date. date -d "29-May-20 09:29 1 minute" +"%d-%b-%y %H:%M" gives output: 29-May-20 09:30 --> Note: I have given here the ...
Ibrahim Quraish's user avatar