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

learn more… | top users | synonyms

2
votes
3answers
45 views

Find records dated before today

how to find record form bellows data having "Last Date" before today's date. i.e : if today date is 09-04-2014 then finding record having "Last Date" before 09-04-2014 - Email ID : abc@domain.com ...
2
votes
1answer
36 views

Why date output X-3 instead X-2 days when I am doing arithmetic operations

In one of my script, I need to find a 2 days back date from a given date. I have been using the below without any issue since long time, but it's just the first time I got a error which drilled down ...
1
vote
1answer
69 views

Date calculation in script for notification alerts

I want to create account expiry alerts therefore I need to write a script which could alert me before 1 month of expiry over email. I'm working on Linux. I can get expiry information as 2015-27-03. ...
2
votes
5answers
105 views

Find all files that have been last modified on a specific day - like Monday?

So I want to use find to return a list of all .html files in a given directory that have been last modified on a Monday. How can I do this?
0
votes
3answers
348 views

Change date only for a single non-root user in Linux [duplicate]

Is it possible to change date only for a specific user (non-root) in Linux ? If possible, How to do it ? And it would be great if someone can point out the impact of doing so. EDIT Putting my ...
2
votes
3answers
197 views

What is a standard command for printing a date in RFC-3339 format?

The date command doesn't offer such thing, which is kind of sad since RFC-3339 is the modern, widespread, sane format used everywhere (except in email which is neither modern nor sane). My timezone ...
15
votes
1answer
259 views

How to trick a particular command into thinking it is a different date?

How can I execute a command making it believe that is on a different date than system one? For instance, if I have this script: #!/usr/bin/env bash date +"%B %d, %Y" It prints the actual date: ...
3
votes
1answer
44 views

Convert unix time from variable to normal time in AIX

-d doesn't work(date: Not a recognized flag: d): date -d @1141421607 and awk's awk -vNEXTEXECDATUM="$NEXTEXECDATUM" 'BEGIN { print strftime("%c", NEXTEXECDATUM); exit }' doesn't work: "awk: ...
1
vote
1answer
46 views

Using wget to target files within a date range

I'm using wget to download some log files from a remote server. Is it possible to use wget to target files using date ranges (based on the last modified file header) ? For example: wget ...
2
votes
1answer
73 views

solaris awk problems with date and if statements

I have daily files that come in via FTP with incorrect dates in the first column of the file. I have figured out how to deduct one day to derive the correct date and print this to a new file. The main ...
1
vote
1answer
60 views

awk date identification from input file

I currently have daily files that come in via FTP with incorrect dates in the first column of the file. I have figured out how to deduct one day to derive the correct date and print this to a new ...
2
votes
1answer
37 views

Highlight today in Mac's cal

Every Mac comes with cal which shows a simple calendar of current month. Output is something like this: February 2014 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 ...
2
votes
2answers
48 views

Using environment variabless in Tmux status bar shell commands

I am attempting to create a tmux status bar which shows three timezones: US Eastern Time :: UTC :: Central European Time. Using the TZ environment variable makes the date command show the time in a ...
1
vote
2answers
124 views

Unable to use date command to change specific date format in Bash shell on OS X terminal

I am using the date -d command to change a specific date format to another. Below is the example used currDate=`Wed 12 Feb 2014` formattedDate=`date -d"${currDate}" +%Y%m%d` echo $formattedDate
1
vote
2answers
60 views

how to add number of days to date's output?

I'd like something like: $ date --date="05/02/2012" "+2 days" would give me "4 may" as output.. how ?
1
vote
2answers
39 views

Is there a way to add some info about time/date to TTY prompt?

If you have a graphical display manager, you can notice date and time there, but I haven't seen such a thing when it comes to TTY. If I want to check the current time (or date) I have to log in. It's ...
1
vote
1answer
66 views

Linux ls wrong date format

I try to find why when I do the command ls or whatever ls -la the column format is wrong with date. It should be like that: -rw-r--r-- 1 johndoe johndoe 55 janv. 26 2011 not like that : ...
1
vote
2answers
75 views

Convert a date format

I have one problem with my date format. I want to change from one format to the other and vice verse. My date formats are: Format1 : 1/24/2014 Format2 : Jan 24 How can I do this?
0
votes
1answer
56 views

Why date +3 equals 3?

Yes, this is a minor issue, but I wonder why date +3 outputs 3 Other options like: date -3 raise an error.
2
votes
3answers
74 views

Timezone setting in Linux [closed]

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 ...
0
votes
2answers
96 views

Display all the dates in week numbers in UNIX [closed]

I know the command to get the week number of a date is date +%W Output: 03 Now, is there a way of giving a week number it will display all the dates in that week? Or should I write a script? Eg: ...
2
votes
2answers
76 views

Specify consistent week boundaries using date

I need to run a certain program passing it the week boundaries. (I use CentOS release 6.4, so a bash/gnu date solution is fine). I tried this yesterday (on Monday): for ((w=1;w<=6;w++)) do ...
4
votes
2answers
58 views

Off by 1 year error in GNU date?

Right now, 2014-01-06, GNU date 8.4 on CentOS release 6.4, does this: $ date --date "last week" +"%Y-%V" 2013-01 On the other hand, $ date --date "last week" +"%Y-%U" 2013-52 which is just ...
5
votes
5answers
607 views

How to parse ISO8601 dates with linux date command

I'm trying to use the date command to generate a file timestamp that the date command itself can interpret. However, the date command does not seem to like its own output, and I am not sure how to ...
1
vote
1answer
130 views

how to subtract a constant value from a data file?

I want to subtract a constant number from my data to get new data file. For example, I want to subtract 10 from my data. data.txt Id a b c d e 1 1 2 3 4 5 2 2 3 4 5 6 ...
2
votes
5answers
561 views

Extract date from a variable in a different format

Let me explain you the problem $ date +%c -d "$d" Tue 31 Dec 2013 01:13:06 PM CET $ date +'Today is %F' -d "$d" Today is 2013-12-31 This solution corresponds to current date. But I have one ...
0
votes
0answers
15 views

UNIX: How to extract date from a variable storing a UNIX DATE [duplicate]

I am facing following issue: Input: F=`date +%Y%m%d` echo $F Output: F=20131231 But when trying this(File Name:A.sh): C=`date` G=`$C +%Y%m%d` echo $C echo $G Output: A.sh[6]: Tue: not ...
4
votes
1answer
51 views

Midnight Commander, using date in User menu

I would like to use MC (midnight commander) to compress the selected dir with date in its name, e.g: dirname_20131231.tar.gz The command in the User menu is : tar -czf dirname_`date ...
3
votes
3answers
275 views

How to delete 2 months back files in unix

Say I have below log files, AA_XX_20130719185428.log exec_xxx_cpb_20130712182453.log 13122013121327_AR_INC_DOBC_1.dprf.log 24122013_masterscript.LOG Date part contains both date and time. I want ...
44
votes
3answers
4k views

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?
6
votes
4answers
377 views

convert date format in log

I have a log with following date format: 2013-12-14 18:53:33 aaaaaaaaaaaaaaaa 2013-12-14 18:53:33 bbbbbbbbb 2013-12-14 18:53:33 ccccccccccccccccccccc What would be the simplest solution to convert ...
3
votes
4answers
206 views

Searching a pattern in file names with number

I have a large number of files in a folder each with the date as the filename. For example 20130101 20130102 20130103 . . . 20130131 similarly for other months 20130201 to 20130230, the pattern is ...
7
votes
3answers
308 views

Why does TZ=UTC-8 produce dates that are UTC+8?

The current time in Los Angeles is 18:05. But when I run TZ=UTC-8 date --iso=ns, I get: 2013-12-07T10:05:37,788173835+0800 The date utility tells me that the time is 10:05, and even says that it's ...
3
votes
2answers
138 views

mutt: conditional date format in “index_format”

I have following value set for index_format in mutt: "%Z %{%Y %b %e %H:%M} %?X?(%X)& ? %-22.22F %.100s %> %5c " which displays date in the format as 2013 Dec 5 I was wondering whether ...
4
votes
3answers
127 views

What could be the use case of changing modified time of a file to the future?

I was reading through the man page of ls on UNIX, specifically OS X Mavericks. This got me intrigued: If the modification time of the file is more than 6 months in the past or future, then the ...
2
votes
3answers
70 views

get list of months using dseq from dateutils

how'd I get a listing of the months in the year (abbreviated) using dseq from dateutils? NOTE simply running: dseq 'jan' 'dec' -i '%b' -f '%b' returns a humongous list of months: piping the ...
4
votes
2answers
92 views

Create sub-directories and organize files by date from file name

I have been using the following script to organize my photos into "Date' Directories: for x in *.JPG; do d=$(date -r "$x" +%Y-%m-%d) mkdir -p "$d" mv -- "$x" "$d/" done This script works ...
2
votes
1answer
57 views

date doesn't accept its own output

What is the option for date to give output in a format acceptable to date --set ? I'm trying to remotely set the date, using the current computer clock of my workstation. ssh user@host sudo date ...
1
vote
1answer
76 views

who -b date format varies strangely

I run who -b to get the date of the last reboot. It returns 2013-10-29 14:55. Now ran by a daemon (I am sending this date to a server) it returns Oct 29 14:55. But some other times (before last reboot ...
0
votes
2answers
702 views

Convert Month Number to Month Name

is there a way to convert month number to name? example: 2013-10-22 will become Oct 22 I don't have the GNU date and my OS is AIX.
2
votes
1answer
146 views

Change System Time/Date

I'm running Linux Mint 15 with KDE 4.10.4+ Here's what I get when I run date: user:~ > date Die Okt 29 15:47:54 UTC 2013 Where "Die Okt" indicates a German-language setting, which I don't ...
4
votes
1answer
59 views

date modifiers explained

Again, I found some interesting I don't understand in an info page, in info dateto be precisely: An optional modifier can follow the optional flag and width specification. The modifiers are: ...
2
votes
4answers
1k views

Next day of the user entered date - date +1 day

I am new to scripting I needed a script in the AIX environment to get the next days date based on the date entered by the user of the script. After hard time browsing for this I got a piece of code ...
1
vote
3answers
442 views

Batch file move to directory structure based on filename

I am writing a script to move files into directories based on the filename. Files have yyyyddmm-xxxxxxx.jpg name format. The desired directory structure is in the format 2013/01 Jan/31. I am unable ...
3
votes
2answers
504 views

Need to get the difference between two time in seconds

The following two variables contain the start time and the end time , need to get the difference between these two time in seconds start_time=06:07:25 end_time=07:02:08 Desired Output diff_time= ...
0
votes
1answer
425 views

Getting a date format with grep

I've looked at similar questions and tried most suggestions, but none of them got me anywhere, even though i have a fairly simple task I think :S. I'm fairly new to this whole thing, so I've run out ...
3
votes
2answers
160 views

Bash-script. Shift seconds

Maybe somebody can help me. In bash I don't know how to do that. I need to do a bash-script. At stdin I have .srt file of subtitles in this format: num HH:MM:SS,SSS --> HH:MM:SS,SSS text line 1 ...
1
vote
5answers
566 views

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? ...
3
votes
4answers
1k views

Convert Unix timestamp into human-readable format on AIX

I need to convert unix timestamp (number of seconds since 1970, e.g. 1381260225 is Tue Oct 8 19:23:45 GMT 2013) into a standard human-readable format. I could get some answers by googling but those ...
-2
votes
3answers
177 views

make ls display current date and time

I'm new to Linux and I'd like ls to display current date and time as a side effect every time I use ls. How do I go about changing what a command does?