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

learn more… | top users | synonyms

6
votes
2answers
129 views

Batch rename image files by age plus add date and variable to filename

The question is completely rewritten due to things learned from the first two answers and comments that I was unaware of when first asking. After a photo shoot I come home with files that look like ...
0
votes
1answer
25 views

change date format and store in variable using awk

I have date in format YYYY-MM-DD in variable 'a'. I want to convert it in format YYYYMMDD and store in variable 'b'. The variable is in an awk variable. How can I do the same ?
2
votes
0answers
9 views

change time (date) in or from exif-data

On Change created date from exif data there are great scripts. But what if “Date and Time (original)” are bad in exif-data (because of wrong set time in camera). Is there a solution to change time for ...
4
votes
3answers
33 views

Local Account Creation Date

For compliance purposes there is the need to fetch information regarding local (user and non-user) accounts creation date on UNIX machines. Is there any way (even if it's not the most reliable or ...
2
votes
3answers
43 views

Get the last minute dated lines from list

If I have an input file with a list of users and their dates they were last signed in, how can I select with a sort | awk function the last minute lines? The dates are written in a +%H:%M:%S format. ...
2
votes
1answer
518 views

What is wrong with this code?

I have a script that goes like this: while : do Start_Time=$(date +"%s") MAIN PROGRAM GOES HERE (CROPPED TO SHORTEN THINGS) Run_Time=$(( $(date +"%s") - $Start_Time )) if [[ ...
2
votes
3answers
63 views

Strange formatting of date in bash script

I am working on a script to sort my downloads folder by the date the files were created. This is the script I am using: #!/bin/bash cd ~/Downloads for FILENAME in * do if [[ -f $FILENAME ]]; ...
2
votes
1answer
40 views

How to get modification time for a file (in UNIX TIME!) on AIX?

$ istat TESTFILE.txt Inode 2317 on device 12/7 File Protection: rw------- Owner: 4847(testuser) Group: 346(testuser) Link count: 1 Length 1480 bytes Last updated: Sun ...
4
votes
1answer
445 views

How to understand the unix time format?

How does the Unix time format work? For example, the Unix time for 3:00 PM is: Normal time format <----3:00PM = 1402565420----> Unix Time How can I make it understand the time as 3:00 PM ?
0
votes
2answers
33 views

How can I search filenames which are starting with xy_* and are created/edited today?

Hello I´m currently trying to search for logfiles which are starting with xy_Number and are created/edited today(not last 24 hrs). I tried: find /home/USER/logfilesError/ -maxdepth 1 -type f ...
2
votes
2answers
106 views

How to get previous year and previous month in solaris 8

How to get previous year and previous month in solaris 8? I have tried below command but none of them is correct: date +'%m' -d 'last month' date +'%Y' -d 'last year'
2
votes
5answers
196 views

Listing files greater than particular timestamp in file name?

I have a directory in linux which has a list of log files where log files get auto generated if some job runs. Each log file gets appended with the timestamp like "JobName_TimeStamp" UPDATED: ...
5
votes
3answers
215 views

How to have command history with timestamps output to the terminal continuously?

I use a simple alias to enable the "tracking" of commands in one or many terminal window(s): alias trackmi='export PROMPT_COMMAND="history -a; $PROMPT_COMMAND"' Then I just tail -f my .bash_history ...
2
votes
1answer
65 views

cut slice of file based on time when lines are written

i have a process running always with logging file could reach up to 5 giga, sometime i have to take slice of this log based on interval of time (usually i used dd). is there any command in linux to ...
1
vote
2answers
78 views

How to mark dates which are in the past?

From the answers I updated the question: Now, it's: $ date "+%F %H:%M" 2014-06-04 11:26 This is the input: $ cat input.txt <tr><td>2014-04-24 14:01</td><td>2014-06-04 ...
2
votes
1answer
35 views

convert to epoch and back

I've used the following two perl command lines successfully: perl -e 'use Time::Local; print timelocal(7,51,10,22,3,2014), "\n";' which returns 1398163867, and perl -e 'print ...
1
vote
3answers
67 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
39 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
117 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
338 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
502 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
313 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
346 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
101 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
109 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
171 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
139 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
48 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
223 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
484 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
70 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
61 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
106 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
3answers
103 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
64 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
162 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
142 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
97 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
63 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
1k 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
178 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
2k 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
86 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
1k 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
578 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
532 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
434 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
202 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 ...