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.
1118 questions
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,007
  • 5
  • 13
  • 27
11 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).
  • 55,442
  • 70
  • 180
  • 243
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
  • 2
  • 13
  • 11
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…
4 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…
  • 1,769
  • 2
  • 10
  • 7
7 answers

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

I have a server running with the timezone 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…
  • 42,359
  • 67
  • 143
  • 166
14 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…
  • 1,561
  • 2
  • 12
  • 7
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,047
  • 11
  • 36
  • 45
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?
  • 16,971
  • 31
  • 91
  • 162
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,061
  • 7
  • 28
  • 43
6 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
  • 13,722
  • 12
  • 61
  • 96
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?
  • 1,399
  • 3
  • 10
  • 16
9 answers

How to append date to backup file

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:…
  • 16,792
  • 34
  • 89
  • 119
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" \;…
  • 863
  • 1
  • 10
  • 10
4 answers

Removing leading zeros from date output

I made an alias of the date command to display date in the following format: 2013. using this command: alias date = date +"%Y.%m.%d.%H.%M.%S" Everything works great, except I want to remove the leading zeroes from the output. There…
  • 1,918
  • 7
  • 20
  • 29
2 3
74 75