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

learn more… | top users | synonyms

1
vote
1answer
22 views

How do I put a time stamp with: wget --output-file=[FILENAME] [URL]

So I've been trying to put a timestamp on some images I'm downloading from a webcam, but so far it's been saving the images with the names camera3_date' here's my line that I enter: wget ...
-1
votes
0answers
22 views

How to check backup file created and exist and the file created with date+time [closed]

The main problem I am facing is daily backup file created with date + time stamp. So the time is not constant with this backup creating in different timestamps. for example below are list files ...
2
votes
2answers
29 views

Get time for system default timezone

When logging in to remote machine X, by default, date will give the time in the local timezone: $ date Mon Nov 17 22:45:47 CET 2014 Note that TZ is not set: $ export | grep TZ $ So, I set TZ to ...
0
votes
2answers
34 views

Can't use argument in bash date calculation script

The following bash script won't work. I need to calculate the date depending on the number of days since 14th Oct 1582, where the argument will be the number of days. d="$1" date -d '14 Oct 1582 + ...
1
vote
3answers
67 views

Date in milliseconds on OpenWRT on Arduino YUN

I am using OpenWRT on the Arduino YUN and I am trying to get the exact date in milliseconds (DD/MM/YYYY h:min:sec:ms) by getting the time by an timeserver. Unfortunately date +%N just returns %N, but ...
2
votes
1answer
20 views

Append same timestamp to multiple filenames

I have several files that I ftp each hour. The receiving system needs to have some sort of identifier that they came from the same batch, so I would like to append a timestamp to the filename. That ...
1
vote
4answers
35 views

Sort datetime string in 12-hour format

I have a log file with contents like this: 11-12-2014 - 03:03:59AM lat = 41.990516; lon = -93.430704<br> 11-12-2014 - 03:05:15AM lat = 41.001546; lon = -93.443352<br> 11-12-2014 - ...
1
vote
4answers
98 views

How to subtract two times in shell

I nee to subtract two lines which is in the format of time in shell. Th time format is hh:mm:ss I used the code below to get the time. cat /var/log/kern.log |grep usb |tail -2| awk '{print $3}' The ...
0
votes
1answer
39 views

Why can't my `date` deal with timezones? [duplicate]

I'm having some weird issues with GNU coreutils date v8.4 (CentOS) that aren't occurring in v8.21 (Ubuntu/Mint). On v8.4, I get the following output (I'm in PST): $ date --version | head -n 1 date ...
2
votes
1answer
87 views

Leap seconds and date

I've just discovered that Unix time does not include the leap seconds. I think it's quite surprising because doing that, it is slowly diverging from UTC... but that's not the point of my question. ...
0
votes
1answer
72 views

How to run commands on a variable containing a date?

I need to be able to take a date in the format of "MM/DD/YY" and change it back into the default date format (Fri Oct 31 17:23:07 CDT 2014). This is driving me crazy. The code below may look ...
1
vote
2answers
39 views

How to convert time from local timezone into Sydney timezone using korn shell?

I need to convert time from localtimezone (CET/CEST) to Sydney timezone (AEDT/AEST). I tried something like this: export date=$(date "+%Y-%m-%d %H:%M:%S AEDT") date "+%Y-%m-%d %H:%M:%S %Z" -d "$date" ...
1
vote
1answer
43 views

How to enter date as an option in a bash command? [duplicate]

I want to enter the current date (ideally in the form YYYY-MM-DD hh:mm) as an option in a bash script: I tried /usr/local/bin/growlnotify -t "PMK" -m date but then the variable -m inserts the ...
5
votes
1answer
34 views

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 ...
3
votes
3answers
216 views

How do I find a file with a name which depends on the current date (and a random component)?

I have to check a particular path every day and find the file with a name of the form: StaticData_Sets_yyyymmdd-232550.txt The date in the name after the string StaticData_Sets_ is updated every ...
1
vote
2answers
80 views

How to get proper format from date for the touch -A argument?

I would like to change all of the attribute times of some files to the immediate date. It appears that I would need to use touch -A * (more or less; realizing that I am going to use a more complex ...
2
votes
1answer
65 views

date command, going back one or two days. Seeing different flags

I'm writing a bash script that should run on OSX and Ubuntu. I'm not sure if this particular problem is due to an OS mismatch; more likely it's a difference in the date command on the two shells, ...
2
votes
1answer
41 views

Where is using @ before a date string for seconds since the epoch documented?

GNU date and touch commands (and presumably others) use @date to define a date string as seconds since the epoch. For example: $ TZ=UTC date -d@10 Thu Jan 1 00:00:10 UTC 1970 I was answering a ...
2
votes
2answers
47 views

Regarding getting Date - n days Date

Suppose I have a particular date stored in a variable (date_m) . I want ((date_m)-25) date. For eg: I have 15/09/2014 stored in my variable , then I want 21/08/2014 returned if I subtact 25 from the ...
3
votes
1answer
67 views

Save lines to different files based on the date

How can I force a re-evaluation of this each time? cat > $(date '+%H-%M-%S').log So that when I first output something it gets written to one file, and after a few seconds I make another ouput ...
2
votes
3answers
540 views

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
0
votes
1answer
72 views

Change the timezone in a terminal

I connect my web server via SSH Terminal on Mac. cat /var/www/vhosts/example.com/statistics/logs/error_log The Date of my server and local computer differs so output of error_logs is not efficient ...
2
votes
3answers
83 views

Convert a number of seconds elapsed to date from arbitrary start date

I want to convert a particular amount of seconds to a date. In my case the it's the number of seconds elapsed since 1st of January 0001. If it were for seconds elapsed from epoch it would be easy: $ ...
1
vote
4answers
89 views

Increment a date in a file

I have a file with single line of text inside.How can I modify its content without using the vi editor.Below is the example: PROCESS DATE =2014-08-01 I want to increment the "2014-08-01" by the ...
0
votes
1answer
138 views

Backing up files which were modified after the last backup was run

I am working on a backup script (bash shell - Fedora - VMware) that should compare a file with last modified attribute and current date and should back it up if the last modified date is older than ...
3
votes
3answers
95 views

Parsing arbitrary natural language dates under BSD

I'm using the GNU date command to parse arbitrary natural language dates - for example to detect if a certain epoch time stamp is from last week, I can do: if [ "$timestamp" -lt "$(date +"%s" -d ...
1
vote
1answer
86 views

Setting System Timezone based on a timestamp

I want to set the system date and timezone based on a string that looks like this (output of Javascript new Date().toString()): Fri Aug 01 2014 12:13:27 GMT+0200 (CEST) The standard way to set ...
1
vote
0answers
65 views

Changing the date format of auth.log

I was looking to change the date format in which auth.log logs information. I could not find a way to do it. Is there a method to do this? My system uses rsyslog.
4
votes
2answers
401 views

How do I find seconds since midnight?

Using the date program, how can I calculate the number of seconds since midnight?
1
vote
1answer
21 views

Unzip all non-existing or older files from archive

The behaviour I'd like with unzip is to extract all files, overwriting any that are older than those in the archive, not touching any that are the same age or newer, and to never prompt. The options ...
0
votes
1answer
63 views

Mount changes directory time to 1970

We are developing an embedded Linux system using BusyBox v1.19.4. The system is working fine except for a strange mount issue with time and date. When we create a directory it has the correct time ...
2
votes
1answer
137 views

mkdir with date function behaves differently in script

I am trying to create a directory with a timestamp. If I type at the prompt mkdir "$(date +%Y-%m-%d_%H%M%S)" I get a directory named with the date as I would like. If I put the same line in a bash ...
6
votes
2answers
602 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
180 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
17 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
2answers
569 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
80 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
533 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
177 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
983 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
657 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
42 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
1k 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
609 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: ...
6
votes
3answers
466 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
125 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
169 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
39 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
114 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
43 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 ...