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.
1159 questions
1842
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?
Jaroslav Kucera
  • 9,422
  • 5
  • 15
  • 28
284
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
  • 57,918
  • 74
  • 184
  • 250
215
votes
5 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…
Angelo
  • 2,159
  • 2
  • 11
  • 7
192
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…
yael
186
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 need…
cwd
  • 44,479
  • 71
  • 146
  • 167
183
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 display…
Rahul Dhobi
  • 2,037
  • 3
  • 14
  • 11
150
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…
Abdul
  • 1,691
  • 2
  • 13
  • 7
137
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…
daniel kullmann
  • 9,427
  • 11
  • 38
  • 45
133
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
  • 17,875
  • 31
  • 103
  • 169
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
  • 8,409
  • 8
  • 29
  • 43
115
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
SHW
  • 14,454
  • 14
  • 63
  • 101
105
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,509
  • 4
  • 11
  • 16
80
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:…
spuder
  • 17,643
  • 36
  • 91
  • 119
71
votes
5 answers

Appending a current date from a variable to a filename

I'm trying to append the current date to the end of a file name like this: TheFile.log.2012-02-11 Here is what I have so far: set today = 'date +%Y' mkdir -p The_Logs & find . -name The_Logs -atime -1 -type d -exec mv \{} "The_Logs_+$today" \;…
I AM L
  • 873
  • 1
  • 10
  • 10
70
votes
9 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,495
  • 4
  • 25
  • 29
1
2 3
77 78