Date is a command line utility for printing or setting the date and time.

learn more… | top users | synonyms

6
votes
1answer
167 views

locale definition with French republican calendar

I wonder if it is possible to create a locale definition that would make the C library format the dates according to the French republican calendar. I expect then, for example, run `date' and get ...
6
votes
3answers
1k views

Equivalent of date --reference in Solaris

The GNU implementation of the date command has a nice feature to show the date of the last modification of a reference file, and using the +FORMAT parameter it is easy to get the date in any format, ...
3
votes
1answer
6k views

show the year while listing files in the current directory

I am working on a red hat server I want to list the files in a way where the year when each was file created would appear in the Date how is that possible ?
4
votes
2answers
506 views

List files created on Sundays

How do I list/find all the files created on Sundays or Mondays? How do I use the date parameter to display them? Something like : ls -f date + %a or find -type f | date +%A or find -type f ...
5
votes
3answers
9k views

Find files which are created a certain time after or before a particular file was created

I need a shell script which finds files which are created 1 hour before or 1 hour after a particular file (test.txt) was created. If I go with find -newer, that means I'd have to create a temporary ...
3
votes
3answers
19k views

linux + add X days to date and get new virtual 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 ...
1
vote
2answers
593 views

Parsing the output of date with sed

I am trying to replace the whitespaces in the output of date with '_' with no success. $date Fri Sep 14 14:10:04 EDT 2012 $ date | sed 's/ /_/' Fri_Sep 14 14:10:24 EDT 2012 As you can see, the ...
17
votes
3answers
9k views

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 ...
1
vote
2answers
16k views

How can I set the time in Centos so that resetting the OS doesn't revert to its default value?

I have a VPS running on Cent Os 5.8 (x86). There are situations in which we are forced to reset the entire VPS (it hangs and the only way to get it back on is to reset it). When we do so, the time is ...
4
votes
5answers
22k views

Display time stamp in dd/mm/yyyy_hh:mm:ss:ms in Unix or Linux

I need help to display date and time in desired format in Unix/ Linux. My desired format is: dd/mm/yyyy hh:mm:ss:ms in Unix or Linux. I got close using the following command: echo $(date +%x_%r) ...
1
vote
1answer
835 views

Change server date using PHP

Is this possible to change Linux server date using php code? Is there any way to give necessary permissions to Apache to do this? What is the procedure to give root permissions to Apache?
0
votes
1answer
399 views

Mplayer cronjob doesn't work [duplicate]

Possible Duplicate: How can I execute date inside of a cron tab job? I made a cronjob to record a stream every friday between 23pm and midnight. Only somehow this doesn't seem to work. ...
2
votes
2answers
895 views

converting unix time to string time with date command

I have read the man pages for date command, but there is no option for converting unix time to string time. I found some websites telling this: date -d @1343715322 there is no option like @ in the ...
6
votes
4answers
5k views

Renaming a bunch of files with date modified timestamp at the end of the filename?

So, say, I have a directory with a bunch of files like g.txt, where g.txt was last modified on, say, June 20, 2012. How would I batch-rename all of the files (like g.txt) with the last modified date ...
2
votes
4answers
7k views

First and last day of a month

Given two numbers, month and year, how can I compute the first and the last day of that month ? My goal is to output these three lines: month / year (month in textual form but that is trivial) for ...
6
votes
4answers
747 views

Date computations without GNU tools

I have to perform some date calculations and conversion in a shell script. For example computing the difference in day between a date formatted as Nov 28 20:27:19 2012 GMT and today. There are ...
2
votes
2answers
257 views

CentOS 5.6 live time feature without repeatedly executing date command

I am using CentOS 5.6, is there a way to view a "live" time, without constantly executing the date command? Constantly excuting the date command can be quite frustrating and repetitive when checking ...
2
votes
2answers
130 views

Is the system time correct when no date has been set?

If I was looking through a debian log file and I come across Jan 1st 1970 08:21:34 in a log, did the action happen at 08:21:34, just the correct date had not been set? Or if no date had been set is ...
1
vote
1answer
135 views

What does XST in the date command output mean?

When executing the date command (on CentOS), it gives me something like this: Thu May 10 20:15:07 XST 2012 My local time zone is CEST, which was at that moment 22:15:07, so the printed time ...
5
votes
1answer
1k views

Get “date” to understand a timestamp phrase of a different language

My web-scraping scripts have long enjoyed using date -d to read in human-formatted time and date stamps like "March 11, 1999" and convert to any other format I need via the -s parameter. How might I ...
6
votes
1answer
459 views

In KDE, how can I create a custom keyboard shortcut that prints the current date?

I often need to print the current date in lots of different programs. Right now, I always type it per hand which is error prone. I'm using KDE 4.8, and it has customisable keyboard shortcuts. For ...
1
vote
1answer
9k views

How can I fake sending -time when sending email with Mutt?

Suppose a student is two hours late in returning an assignment. Now the assignment needs to travel a long way in internet so there is a good excuse that it got lost in somewhere or got jammed (well ...
10
votes
2answers
544 views

What is a distro-agnostic way determine the OS install date?

I am on a CrunchBang machine and trying to write a script that needs to have the OS install date as a reference. I searched and found this command: ls -lct /etc | tail -1 | awk '{print $6, $7, $8}' ...
3
votes
2answers
2k views

UNIX move file name with sysdate

I want to make a script in Unix in which I have to move a file daily to a specific path. In order to avoid overlapping of the file, I want the file name along with the date. e.g. mv filename ...
6
votes
3answers
721 views

sort at jobs chronologically

Possibly a simple solution I misplaced. How can I get the output of atq sorted chronologically, so I can easily see who's due to run next? The man page for sort doesn't have anything built-in to ...
2
votes
5answers
406 views

Is it possible to reference the most recently modified file in a command line argument?

I frequently download PDF files with heinous numeric file names from my browser. These automatically go into ~/Downloads. Ideally I would like to just be able to open these files with: evince "the ...
3
votes
2answers
6k views

List of Recently Modified Files

How can I Get a list of all files modified , say 3 months ago. I checked this question but I was not able to apply it to my scenario. I am trying this now , it seems to be working , but I know there ...
3
votes
9answers
2k views

How to generate a year-quarter date from the command line?

I'm interested in outputting a representation of the current year-quarter, as well as the year-quarter for the previous month. If today is 2012 January 1st, I'd like to get 2012q1 and 2011q4 as ...
0
votes
1answer
251 views

Setting system/hardware clock under Debian

I have installed a system with a London timezone, instead of using Central European Time. The problem is, that hwclock says the time is 11:00, date says the time is 11:00. I have changed the timezone ...
19
votes
6answers
31k views

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 ...
2
votes
1answer
509 views

How to insert a first column to many files + how to convert unix time to normal time

There are many-many files in a directory that has e.x.: the following content: INPUT: root 1324711901 sshd 1272725792 And I'm searching for a solution how to convert the content of the ...
3
votes
6answers
4k views

Trying to set date on a Linux based machine from another machine

I am running busy box on an embedded platform. I would like to set the date on the box properly each time I reboot the hardware. I have no way to save the time persistently, so am reduced to setting ...
4
votes
2answers
2k views

/etc/shadow date of last password change—UTC or local time?

man 5 shadow gives the following description of the third field in each line: The date of the last password change, expressed as the number of days since Jan 1, 1970. The value 0 has a ...
3
votes
2answers
2k views

How to get 3 minutes future date?

I want to get the date 3 minutes on the future. For example, if "now" is 01-Jan-70 00:00:00 GMT I want to get 01-Jan-80 00:03:00 GMT How should I do it? I'm working with busybox linux.
2
votes
2answers
313 views

Padding day / time values to ensure 3 digit length

I have a script which renders timestamps in the format YYYY'DDD'TTT where Y = year, D = day out of 365 and T = time in 1000th's of the day: #!/bin/bash clear s=$(($(date +"%H*3600+%M*60+%S"))) ...
3
votes
1answer
116 views

Generate time as expression of 1/1000ths of the day

Completely new to bash and having trouble working out how to make the arithmetic work. I think this should be easy, it's just.. argh. I want to express the time of day in terms of 1/1000ths (ie, ...
5
votes
1answer
255 views

Remind syntax combining a weekly event with a time range

How should I write "Every Tuesday, Thursday, Friday after 2011 Sep 13, but before Sep 28, with reminder 1 day before event". Now I got REM Tue Thu Fri 13 Sep 2011 +1 UNTIL 28 Sep 2011 MSG Esem, but ...
9
votes
3answers
2k views

How to use the date command to find out what date “monday week 40” will be?

How can I use the date command to convert something like "monday week 40" into a ISO date? I am playing with something like this: date --date='monday week 40' +'%Y-%m-%d' And the date I'm ...
2
votes
3answers
3k views

How to feed the results of date command into grep to filter results of another command

I need to use the result of a formatted date command (date +"%m/%d") as the grep filter to filter the results of another command that will display alerts on a system so that I only see alerts from the ...
2
votes
1answer
894 views

Need help converting a string from a file into a date

I'm trying to read a string from a file and then convert it into a date but for some reason it's failing. I'm actually modifying a GeekTool Geeklet that's not working at the moment. It reads a file ...
8
votes
1answer
3k views

Is there a way to adjust the formatting of the date/time in the GNOME 3 login screen and desktop?

I'm specifically looking to change the formatting in two places: On the desktop, the date/time reads "Sat 21:05". I would like it to read "23-Jul-11 21:05" or "23 Jul 11 21:05". In other words, I ...
3
votes
1answer
402 views

bash: cd to the most recently modified child directory

Wondering if there's an easy and/or portable way to say "change to the most recently modified child directory." I can use ls and awk but there's probably a better way. cd $( ls -ltrd */ | tail -1 | ...
9
votes
2answers
1k views

How can I delete all files in a folder that haven't been accessed in a certain amount of time?

I'd like to run a nightly cron job that deletes all the files in a folder that haven't been accessed in a week or more. What is the most efficient way to do this in bash?
-1
votes
1answer
2k views

Sum of grep results

I need to output the sum of a grep results for a certain time, for now i hard coded the time grep but any help will be very much appreciated, my problem is i cant output the results on the script. If ...
3
votes
1answer
1k views

using system command in awk script

In an AWK script I am using a command system(date) to print the current date in a file but after this command is executed next line is also added implicitly. Is there any way in AWK to print ...
7
votes
4answers
590 views

Forcing an 'added' alias to every command

Is it possible to forcibly add a timing alias (for lack of a better way to phrase it) to every command in bash? For example, I would like to have a specific user who whenever a command is run, it is ...
4
votes
3answers
342 views

Setting linux time

$ date 042612492005 $ hwclock -w The code above shows how to set the system time, but how's the timestamp string generated in the first place?
1
vote
3answers
1k views

Highlight the current date in cal

I would like to highlight today's date in the output of the cal command. What is the best way? This is what I have so far: cal -m | grep -C6 --color "$(date +%e)" but it doesn't work for all cases ...
1
vote
3answers
1k views

How many minutes have passed since the Unix Epoch?

Sorry for the lame question How many minutes have passed since the Unix Epoch ? It should be January 1, 1970 ? Let's say approximately until 1 Jan 2011... 5 865 696 000 minutes ?
12
votes
4answers
14k views

How to list files sorted by modification date recursively (no stat command available!)

How can I get the list of all files under current directory along with their modification date and sorted by that date? Now I know how to achieve that with find, stat and sort, but for some weird ...