Questions tagged [date]

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

Filter by
Sorted by
Tagged with
1 vote
0 answers
813 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
0 votes
1 answer
244 views

How can I obtain the time stamp from a file or directory in touch format?

According to many websites I found online the touch commands' -t argument accepts the time stamp in the following format: [[CC]YY]MMDDhhmm[.ss] Here, CC: The first two digits of the year. YY: The ...
Zoltan King's user avatar
0 votes
2 answers
647 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
6 votes
1 answer
928 views

Is there a reserved word for datetime for the start of the day?

man date won't show me any reserved words but they have 'now' or 'today' etc. I wonder if there is any clear way to print start(00:00:00) of the day. Will date -u -d "$(date +'%F')" suffice ...
Lunartist's user avatar
  • 385
0 votes
1 answer
867 views

How to change the modification date (The Metadata) of multiple files?

I have a gallery folder with multiple images and videos, some of them has their modification date correct, and some of them has the month wrong. I want to make a script that will change all the files ...
userbash654's user avatar
0 votes
1 answer
42 views

How to disable time sync in a VMware shared folder?

My Windows 10 desktop has VMware. To set past time in VMware, I disabled sync options as described here: https://kb.vmware.com/s/article/1189 I just tried to set the date to past time in VMware. And ...
Carter's user avatar
  • 136
2 votes
2 answers
2k views

Script - Compare filename date with current date

I'm trying to compare a file with date in its name to the current datetime of the system: Filenames are with the following format: FileName.yyyymmdd.hhmm.file (e.g. File156tr.20220914.0958.txt) I have ...
joniop's user avatar
  • 51
4 votes
4 answers
2k views

Precision of the date command and arithmetic

I take a date at nanosecond precision: $ start=$(date '+%s.%N') ...then print it: $ echo ${start} 1662664850.030126174 So far so good. But look what I get when I printf with some arbitrarily huge ...
The Poopsmith's user avatar
0 votes
3 answers
493 views

Read and convert date from file

I'm using a CentOS and I want to write a shell script. So I have a file with a date: > > cat VM1_EOMAP_TIME.log 07 Sep 2022 16:30 > And I want to get the minutes since current time and the ...
Carlos Martin's user avatar
0 votes
0 answers
117 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
256 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
1k views

How could awk be made timezone aware?

A timestamp (In layman terms) could be an ISO8601 string (generally the output of the POSIX specified %FT%T format) with a zone string added (Loosely, one of the two formats available in date, either %...
QuartzCristal's user avatar
-1 votes
1 answer
205 views

How to get user creation details

Kindly assist to to get user creation details (date and time) and users login details in Solaris 10
eliot's user avatar
  • 31
3 votes
3 answers
929 views

Date sorting format: Day-Month-Year

I have a text file with date value. Data: 01-Sep-21 02-Jan-22 12-Aug-21 24-Dec-21 11-Jul-22 How to sort these data from old to new date value?
SAniul HOssain's user avatar
6 votes
1 answer
1k views

ls: bash: printf: `Y': invalid format character in VS Code, not in Terminal

I upgraded to Linux Mint 21 (based on Ubuntu 22), having number of small issues, one of which is in VS Code, not in Terminal (gnome-terminal), running ls alias: bash: printf: `Y': invalid format ...
Vlastimil Burián's user avatar
-2 votes
2 answers
133 views

Real Time clock regarding timestamp storage

I gone through some of the datasheet regarding RTC like MCP79411X, but having confusion like where RTC stores timestamp in sram or eeprom, can anyone explain me the flow of the below fig suppose ...
Sukanya U's user avatar
-1 votes
2 answers
261 views

Where does RTC stores Date and Time in SRAM or EPROM

I gone through some of the datasheet regarding RTC like MCP79411X, but having confusion like where RTC stores timestamp in sram or eeprom, suppose RTC store Time in sram means it is volatile memory ...
Sukanya U's user avatar
0 votes
2 answers
109 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
2 answers
562 views

converting date formats with awk/gawk on macOS

I have millions of rows of data my boss has asked me to reformat for them. The format is: 06/28/2022,04:00,142.01,142.38,141.59,142.15,3151 06/28/2022,04:01,142.1,142.1,142.1,142.1,196 I need to ...
Jasmine S-M's user avatar
1 vote
1 answer
94 views

Bash output of date in bash script

I wrote this script: #!/bin/bash target="1.1.1.1" while true; do ping $target -c 1 -v > /dev/null if [[ $? -ne 0 ]]; then echo "$(date +"%d/%m/%y ...
Julian Zalewski's user avatar
1 vote
4 answers
744 views

Given a weekday name, week of a month, and a year, how to find the date

I can find the last Monday using date -d 'last-monday' +%F but given a weekday name, week of a month, and a year, how to find the date? e.g. given: Monday, Week 4, June, 2022 output: 2022-06-20 given: ...
surz's user avatar
  • 21
7 votes
1 answer
3k views

How can I shorten HH:MM:SS as much as possible?

Suppose I have the following syntax: HH:MM:SS. I want to make it as short as possible. For example, I want "00:00:30" To turn into "30". Similarly, I want "0:30:00" to ...
Amarakon's user avatar
  • 333
2 votes
1 answer
1k views

Why might `date` be showing 12h format?

I've always seen 24h time shown in the date output. But for some reason, my Debian-based machine is now showing 12h time format: $ date Fri 10 Jun 2022 06:16:47 PM IDT $ LC_TIME=en_IL.UTF-8 date Fri ...
dotancohen's user avatar
  • 15.9k
0 votes
1 answer
102 views

How to replace a string containing date and IP with sed command

I have the following string of characters, including the IP address and date. For some security reasons, I need to hide the first two digits of the IP address. text 200.200.10.2 2022.05.07 15:32:43 ...
xionngle's user avatar
2 votes
2 answers
520 views

How to get unix time of 11PM, and 11PM CST tonight using BSD's date command?

BSD's date -j -f seems to mix seconds and minutes from the current time of the day while still accepting '%H%p' in the time format. All I want to do is convert input format to correct unix time. Also, ...
codepoet's user avatar
  • 586
0 votes
1 answer
858 views

How lookup deletion date of files in Trash from command line

I want to restore I file I deleted accidentally. I cannot go to the trash/wastebasket folder and simply restore the file, because I've no idea what the file was. I deleted it by accidentally pressing ...
markling's user avatar
  • 213
20 votes
3 answers
3k views

What's the POSIX-compliant way to get the epoch timestamp in a shell?

I just noticed, that POSIX date doesn't seem to have the %s or %N format items. So I can't use those. What's an alternative, yet POSIX-compliant way to get the epoch timestamp in my shell script?
finefoot's user avatar
  • 3,080
3 votes
2 answers
239 views

Setting time zone in a kindle bash file

I've recently jailbreaked my kindle to make it a clock that shows a certain image for each minute of the day. I used the instructions mentioned in this article https://www.instructables.com/Literary-...
Amr M. El-Dawoody's user avatar
1 vote
0 answers
22 views

Counter-intuitive date command [duplicate]

I've been using date in a script in order to add one year to a specific date the following way: date '+%Y-%m-%d %H:%M:%S' -d "$DATE + 1 year" In this example, DATE looks like 2022-05-11 14:...
InsaneClock's user avatar
3 votes
1 answer
583 views

Is my zoneinfo backwards or am I confused

As far as I know, United States Eastern Time is GMT-5 for Eastern Standard Time, and GMT-4 for Eastern Daylight Time. So why do these two commands give different hours in the answers? laptop % TZ=...
hymie's user avatar
  • 1,710
1 vote
1 answer
172 views

FreeBSD - get timezone in Continent/Region format

I have a Linux (bash) script to generate a login message (motd). One of the things it displays is the timezone, using the command timedatectl | grep Time | awk {'print $3'}. The command returns ...
PGEL's user avatar
  • 137
1 vote
1 answer
449 views

How do I set the date to the epoch of a linux (raspbian flavor) system, i.e., 1 January 1970 00:00:00? [duplicate]

I am trying to set up a Raspberry Pi with the date and time to the beginning of time from the linux point of view. In my understanding, the epoch is 1 January 1970 00:00:00. The first step was to set ...
user74549's user avatar
0 votes
1 answer
2k views

trying to add X hours to an arbitrary date in bash

Given a date string like this: 2022-03-28T23:40:49.721Z I am trying to add X hours. the function would look similar to addHours() { dateString=$1 hours=$2 return date -d 'dateString + $...
Tracy Lauren's user avatar
1 vote
1 answer
270 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
0 votes
2 answers
695 views

trying to get number of seconds from the epoch to the day, using %s, getting invalid date

When I'm trying to run the below command, I'm getting correct output date --date="04/1/2022 7:1:00" +'%s' output: 1648776660 But when trying to run the same command with a different date, ...
Arya's user avatar
  • 316
3 votes
2 answers
3k views

PERMANENTLY change the output format of the 'date' command in my Kali Linux

So I have 2 different Linux installations. One of them is Ubuntu and the second one is Kali. When I run date command with no options/arguments on my Ubuntu install I get: michal@ubuntu:~$ date Thu 24 ...
michal roesler's user avatar
0 votes
2 answers
795 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
4k views

Format datetime as UTC with strftime (for use in git)

I can format dates and time pretty flexibly with strftime, but from what I can see, this only will give times in my local timezone; I can add the timezone offset (e.g. '%Y %m %d-%H:%M:%S%z' for a ...
jkmartin's user avatar
  • 113
0 votes
1 answer
86 views

Subset of File between two dates, when some dates are invalid

I have come across several similar questions, but the solutions seem to be failing me, and I believe it is because I have some junk data in my file that is breaking my attempt to filter by time stamp. ...
Vint's user avatar
  • 107
0 votes
1 answer
1k views

How to convert Linux date to another date format

I am getting date in one of file in the format "Fri Feb 25 16:07:17 UTC 2022" Which I want to convert it to "2022-02-25 16:07:17". However I am able to do it using Python but its ...
prashant thakre's user avatar
-1 votes
1 answer
623 views

Find "latest" path, filename, date, and time at every level of a folder subtree with Bash [closed]

Using Bash, I want to find for any specified directory and its subtree the filename, creation_date and creation_time for the file last created in that directory. For example, the output would be: /...
prat's user avatar
  • 9
2 votes
3 answers
438 views

Convert mm to hh:mm

I am using awk to get all of the 4th comma-delimited fields, which is a duration in minutes. The required output is in the format of hh:mm, so I need to convert that from minutes. "jone",&...
SRash's user avatar
  • 111
0 votes
1 answer
475 views

date string column to timestamp column in a log file

I have log.txt with sample output like these: ... 10-Feb-2022 15:15:14.099 lorem 10-Feb-2022 15:15:15.133 ipsum 10-Feb-2022 15:15:16.233 dolor ... I expect the output of filtered log.txt will be ... ...
Muhammad Ikhwan Perwira's user avatar
1 vote
1 answer
783 views

Convert string time to seconds

I'm receiving an uptime in this format: 167h58m10.586582048s I want to transform it to seconds and discard the fraction part. I know awk could do that if only the received string had the same ...
markfree's user avatar
  • 365
0 votes
4 answers
778 views

date: starting with year and week number, how to have the date Monday

How can I get the ISO date for a specific week's Monday? For example, the Monday of the 32nd week of 2021? I know that if I run date -dmonday +%Y%m%d I will get the the Monday date of the current week....
aborruso's user avatar
  • 2,855
0 votes
4 answers
662 views

How to get date string from stat command?

I have this to get the timestamp of a directory: stat -c %Y directory_name What can I pipe this to, to get the date formatted like this? 20220201
CJ7's user avatar
  • 839
1 vote
2 answers
2k views

How to give file name as current date in expect

I have wrote a script in expect as follows. I want to give date as variable to cd command but when I am giving the date as variable to the command and it add '' commas and therefore it shows a error ...
Thisura's user avatar
  • 21
1 vote
1 answer
596 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
  • 181
7 votes
3 answers
1k views

Where can I find a complete list of format specifiers for the date command?

I wanted to get the month name on macOS 11.6, and I tried checking the man page of date checking the man page of strptime But I couldn't figure out what format specifier to use to display the month ...
mtk's user avatar
  • 27.6k
0 votes
1 answer
416 views

Show only dates bigger than the search pattern even if the search pattern does not exist in the (log) file

I want to search the syslog for dates bigger than a specific search pattern. For example I want to find every syslog entry where the date is bigger than JAN 6 16:24:00. I know I could use sed (sed -n ...
manifestor's user avatar
  • 2,473

1
2
3 4 5
24