Questions tagged [date]

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

The tag should be used for questions that are about handling calendar dates on Unix-like systems like for instance:

  • How to convert dates from different formats or calendars
  • How to do calculations on dates
  • The date-related utilities, in particular the date command and its variants like the GNU version. Or the dateutils series of commands.
  • The display, nationalisation of dates

Related tags:

  • : more appropriate for setting or synchronising the time on a system.
  • : more appropriate for discussing calendaring software.
  • : can be used in combination with to further qualify timezone-specific questions.
  • : for the network time protocol.
  • : for questions related to tag events with dates.
1199 questions
2023
votes
3 answers

Why does man print "gimme gimme gimme" at 00:30?

We've noticed that some of our automatic tests fail when they run at 00:30 but work fine the rest of the day. They fail with the message gimme gimme gimme in stderr , which wasn't expected. Why are we getting this output?
311
votes
12 answers

How do I convert an epoch timestamp to a human readable format on the cli?

How do I convert an epoch timestamp to a human readable format on the cli? I think there's a way to do it with date but the syntax eludes me (other ways welcome).
xenoterracide
  • 61,953
  • 80
  • 197
  • 254
264
votes
6 answers

date command --iso-8601 option

This answer and comments mention --rfc-3339 and a "hidden" --iso-8601 option that I have used for a long time and now seems to be undocumented. When did that option documentation get removed from the --help text? Will the option go away anytime soon?
Angelo
  • 2,649
210
votes
5 answers

How do I add X days to date and get new date?

I have Linux ( RH 5.3) machine I need to add/calculate 10 days plus date so then I will get new date (expiration date)) for example # date Sun Sep 11 07:59:16 IST 2012 So I need to get NEW_expration_DATE = Sun Sep 21 07:59:16 IST 2012 Please advice…
yael
199
votes
7 answers

How can I have `date` output the time from a different time zone?

I have a server running with the time zone set to UTC . It seemed like that was generally a good practice (please correct me if I'm wrong). Anyhow, one of the servers I connect to, in order to scp files, is running on EDT and stores files that I…
cwd
  • 47,367
184
votes
3 answers

Timezone setting in Linux

I'm setting the timezone to GMT+6 on my Linux machine by copying the zoneinfo file to /etc/localtime , but the date command is still showing the time as UTCtime-6 . Can any one explain to me this behavior? I'm assuming the date command should…
Rahul Dhobi
  • 2,047
166
votes
15 answers

How to compare two dates in a shell?

How can two dates be compared in a shell? Here is an example of how I would like to use this, though it does not work as-is: todate=2013-07-18 cond=2013-07-15 if [ $todate -ge $cond ]; then break fi How can I achieve the desired result?
Abdul
  • 1,851
144
votes
18 answers

Quickly calculate date differences

I often want to make some quick date calculations, such as: What is the difference between these two dates? What is the date n weeks after this other date? I usually open a calendar and count the days, but I think there should be a program/script…
143
votes
5 answers

last time file opened

Is it possible to get the time when file was opened last time and sort all files in a directory by those times?
student
  • 19,035
134
votes
7 answers

Linux: set date through command line

How to change the system date in Linux ? I want to change: Only Year Only Month Only Date Any combination of above three
SatishWagh
  • 15,504
124
votes
7 answers

Show the year while listing files in the current directory

I am working on a Red Hat server. The commands ls -l or ll giving me the date and time in format +"%b %-d %H:%M" . I want to list the files in a way where the year when each was file created would appear within the date. How is that possible?
WAEL
  • 1,699
124
votes
4 answers

Day of week {0-7} in crontab has 8 options, but we have only 7 days in a week

Day-of-week: Allowed range 0 – 7. Sunday is either 0 or 7. I found this after Googling, my question is why should both values (0,7) correspond to Sunday?
Ruban Savvy
  • 9,041
87
votes
10 answers

How do I set time and date from the Internet?

How do I retrieve the date from the Internet and set my computer's clock, from the command line?
Mohsen
  • 2,765
81
votes
9 answers

How to append date to backup filename

I need to make a backup of a file, and I would like to have a timestamp as part of the name to make it easier to differentiate. How would you inject the current date into a copy command? [root@mongo-test3 ~]# cp foo.txt {,.backup.`date`} cp: target…
spuder
  • 18,753
76
votes
1 answer

How do you time how long a command took to run?

How would you find out how long a running process took to complete? Example: date; dd bs=1m if=/foo of=bar; date ^This example only has 1 second of resolution. Any shell is acceptable.
spuder
  • 18,753
1
2 3
…
79 80