the "date" tag is used to classify questions about date/calendar/time manipulation, visualisation, conversion... on Unix-like systems.

learn more… | top users | synonyms

0
votes
1answer
59 views

inserting modified date into filename - 2 cases

I believe I'll ask two separate questions, but the context is the same, so I hope it's alright. I have an output of few processes as presented below (which I can't modify). 25978.csv 26044.csv ...
0
votes
2answers
28 views

FreeBSD date utility -r switch confuses me

I have a bash script which I need to convert from linux to FreeBSD, but I'm obviously too stupid to read the man page in a proper way. The script has a line along: date +%d -r "$file" which works ...
2
votes
1answer
50 views

Getting the date from a ssh client

I have a problem with an embedded computer where it does not have a separate Real Time Clock and as such every time I reboot it, it loses track of the current date. This is very annoying because lots ...
1
vote
1answer
14 views

Display the package date in the Aptitude UI

The Aptitude README (on Ubuntu 16.04, under /usr/share/doc/aptitude/README) gives the escape codes to customize how the packages are displayed in the UI (typing aptitude without any parameters at the ...
3
votes
2answers
33 views

Prevent updates to 'modified time' when copying files to a mounted Samba folder

I don’t want the “last modified” attribute to be changed to the current date when copying files to a mounted Samba folder. How can I do this? This behavior occurs with (K)Ubuntu 12.04 and Ubuntu ...
4
votes
2answers
70 views

Millisecond time in a shell script

How can someone print the entire time ie, for example 12:07:59:393(HH:MM:SS:milliseconds) in milliseconds. I found a lot of posts saying how to print Milliseconds along witht HHMMSS but I want to ...
-1
votes
1answer
15 views

Why %H%M%S is not working in .screenrc?

According to this answer, I can rename logfile of screen with date to avoid logfile appending problem But %c used in that answer contains a colon, like 19:00. Since I have to sync files with windows, ...
0
votes
1answer
34 views

command /opt/bin/date --date '-15 minutes 2016-04-27T14:14:47' producing result many hours before stated time

I'm using the following command in an attempt to work out the time 15 minutes before the timestamp: /opt/bin/date --date "-15 minutes 2016-04-28T16:58:55" '+%Y-%m-%dT%H:%I:%S' The problem is the ...
3
votes
1answer
44 views

How do I set up busybox to allow a non-root user to set the date?

I have an embedded system built with busy box. I allow a user named "app" to download a program/script to a directory and it will be run on boot. The program should be allowed to set the date. It ...
-1
votes
1answer
22 views

adding date to beginning of file name using script

I have multiple files that need to be renamed with a date added to the beginning of the file name that I am trying to script. I'm using the cp command because I need to keep the original file I need ...
1
vote
2answers
57 views

at now - different date

This is my current system date root@48392:/home/# date Mon Apr 25 19:08:13 CEST 2016 Now I set up an at job... root@48392:/home/# echo "ls" | at now warning: commands will be executed using ...
1
vote
4answers
108 views

Dangers of using rm command with variables

I am creating a crontab that compresses 15 minute clips from my security camera into one file (24 Hours Long) and then having the clips delete. avimerge -o /media/jmartin/Cams/video/Full_$(date +%F ...
0
votes
1answer
42 views

How do you put date and time in a file name?

I'm trying to execute a command and would like to put the date and time in the output file name. Here is a sample command I'd like to run. md5sum /etc/mtab > 2016_4_25_10_30_AM.log The date time ...
1
vote
2answers
54 views

Time travelling and log files

When testing changes to a legacy codebase on a development system, my preferred method of testing is to set the system clock to a date in the past, eg date -s '-7 days', I then playback some ...
0
votes
1answer
16 views

Set date with milliseconds from epoch

How do I set the date using milliseconds and or seconds from epoch? date -s 127846398127?
1
vote
1answer
38 views

linux redhat + change time from UTC to GMT+X

how to change the time from UTC to GMT+2 my current date is UTC as the following 20:23:48 root@linux-test01:~ # date Sat Apr 16 20:23:52 UTC 2016 and I want to change it from UTC to GMT+2
-1
votes
2answers
51 views

How to convert a string into a date in a given format

Need a string in '9-2-1832' format in a '1832-09-02' format. Must be able to fill a 'date' type field in mysql.
3
votes
3answers
54 views

Get lines between two timestamps from a file

I have this large file that I need to go through using date and time. Every line in this file has a date and time in it. I need to search through the lines and get the lines that lie between two ...
1
vote
1answer
31 views

Set ls -l time format

I would like for all my ls commands that display a date, such as ls -l, to print the date column in a format of my choosing. Currently, I manually set this every time with --time-style. Is there any ...
1
vote
3answers
102 views

How to list all weekends for the next 6 months?

$ SAT=$(date -dsaturday +%Y-%m-%d) $ SUN=$(date -dsunday +%Y-%m-%d) $ $ echo $SAT 2016-04-09 $ echo $SUN 2016-04-10 $ I know how can I list the next dates for Saturday and Sunday. How can I list ...
0
votes
0answers
11 views

File manager: show “create date” [duplicate]

I'm using Linux Mint 17 Mate with Caja file manager. I find it very useful to know the date a file was created - this doesn't seem to be an option in CAja, or with Linux as far as I can tell so far - ...
2
votes
2answers
100 views

Get previous month regardless of days

In Linux, I can get last month by using date -d "last month" '+%Y%m' or date -d "1 month ago" '+%Y%m' But say, today is 31st of March, if I run the command at top, it shows 201603, but I want ...
3
votes
1answer
27 views

How to increment a day in a date that is stored in a variable

I am on OSX and have a date variable stored in $d which is formatted like %Y_%m_%d. So echo $d would give something like 2016_03_29. I want to increment the day by 1 so it becomes 2016_03_30. From ...
0
votes
1answer
29 views

How to implement config file expiration time?

I have a Debian server which runs a service using multiple config files (in a similar way to apache2) which I need to add an expiration date to. The config file that has an expiration date starts with ...
4
votes
1answer
157 views

Piping into moreutils' ts with nanosecond precision?

On this system: $ cat /etc/issue Ubuntu 14.04.4 LTS \n \l $ uname -a Linux mypc 3.19.0-56-generic #62~14.04.1-Ubuntu SMP Fri Mar 11 11:03:33 UTC 2016 i686 i686 i686 GNU/Linux $ apt-show-versions -r ...
4
votes
2answers
124 views

Failure of ntpdate if the system is set to a date beyond 2038

The correct current date is .Fri Mar 25 12:11:07 CST 2016. When I change the date to "2018/01/01", ntpdate works properly. When I change the date to "2099/01/01", ntpdate does not work properly. ...
1
vote
1answer
25 views

Actively monitor the modified date of all files in a directory

Is there a way to actively monitor the modified dates of all files or directories in a current directory? I am using the BASH shell. By actively I mean run a command once and then be able to monitor ...
4
votes
3answers
107 views

UTC vs. localtime has an offset of about 25 seconds

I have compared this in different systems, but only get this behavior in an embedded system running Arago linux. I use the date command from BusyBox v.1.13.2 I executed this two commands ...
0
votes
0answers
17 views

How to change the date format in the LXDM login/greeting screen (LXDE)

I found a number of resources to change the system (Archlinux 2016-03-01) date format, amongst others one to create a new format from an existing locale file. I then modifed /etc/environment and ...
0
votes
2answers
46 views

Number of Seconds since epoch in solaris 10

I am trying to get the number of seconds since the epoch in both Solaris 10 and Solaris 11. On Solaris 11, "date +%s" is giving me the output (from bash), but the same is failing on Solaris 10. What ...
0
votes
1answer
48 views

Append row count and date to filename

Is there a way to append both a row count and a date to a filename? I have a file I am creating in SAP and upon output I would like to run a script to change the filename per my client's ...
1
vote
1answer
31 views

Make a directory named with date

I want to make a directory with the name being the day. I have this variable: [Desktop]: $dia 21/02/16 created this way: dia=$'date +%d/%m/%y' I'm trying to make a new directory this way: mkdir ...
9
votes
1answer
273 views

Why are these 2 date commands giving different results?

$ date -d "Apr 1 2016 - 1 month" +%B gives me "March", which is great - the month that comes before April is March. If I do this however: $ date -d "$(date -d "Apr 1 2016") - 1 month" +%B it ...
2
votes
2answers
51 views

Reformat date to unix time stamp in csv table

I have a .csv file containing the date and time in the format 01/20/2016 23:53:01 in the first column. My columns are separated by semicolons, i.e. 01/21/2016 03:03:01;18616;0;1 01/21/2016 ...
2
votes
4answers
135 views

How can I get relative date based on relative date by linux date command?

Can I get "last monday based on 10 minutes ago" by linux date command ? For example current time: 2016-02-09 00:05:00 expected result: 2016-02-01 00:00:00
0
votes
1answer
72 views

add 10 days for UNIX timestamps output

I've file contain many of epoch / UNIX timestamps need to add for example +10 days for output date so then I will get new date and I've create bash script with date command but seems doesn't work ...
3
votes
3answers
358 views

How to sleep until a given date & time?

I want to write a shell where given a date (day-hour-min) e.g. 10:00 AM Sun 2:30 PM Mon ... It sleeps until that exact date & time. I thought one way of doing it is, I could get the current ...
2
votes
2answers
46 views

Renaming a file the moment it appears in a folder

Here's the context : on a samba server, I have some folders (that we'll call A,B,C,D ) which are supposed to receive files from a network scanner. The scanner renders a PDF file named like this : ...
3
votes
1answer
85 views

How can I output month name in a given timezone

I would like to have the output of date +"%B, %d %Y" in my local timezone but considering another timezone for the names (month name in this case). In my system the date +"%B" outputs (please note ...
0
votes
1answer
39 views

How to move (image) files to other directories based on files' dates

I have a directory (currdir) with 24000 images on a centos/cpanel server. I want to split this directory by moving images from this directory into other directories (or sub-directories inside currdir) ...
0
votes
2answers
26 views

search the most latest's file name

I am writing a bash script to look for a file which's file name is most recently and file name like: ... Wed_Dec_30_16:47:41_PHT_2015.zip Wed_Dec_30_16:00:41_PHT_2015.zip ...
1
vote
2answers
31 views

Output both ps and Date on one line, to a file?

I am building a rudimentary logging script, and want to capture the output of ps up 12345 So far I have: DATE2=`date +%Y-%m-%d:%H:%M:%S` echo ${DATE2} >> $filename ps up 12345 --no-headers ...
3
votes
1answer
53 views

how to remove 0 (zero) from the day and month but not from the year (01/09/2012) using in Linux (Redhat)

Using Linux (Redhat) I need some help regarding the a/m request When I use dialog: --calendar to output the date. The format will be dd/mm/yyyy but I need the format to be d/m/yyyy for day and month ...
0
votes
1answer
72 views

Count the number of files with yesterday's date in ls's output

I would like to count the number of files with yesterday's date in ls's output. I tried: yday=$(date --date="yesterday" +"%b%Oe") ls . -ltr | grep $yday | wc -l The problem is that files have dates ...
0
votes
1answer
48 views

How to set date with Epoch format

I want to set date from a seconds since epoch value, for instance I want to set date with input value 1452053571. I read through date -help but not found anything. Is there any parameters to do it?
3
votes
2answers
135 views

Find all files modified around a known one

An installer which isn't really clean (Adobe Acrobat Reader DC) installed on my Unix (Mac OS X) a lot of files in different places. I have a reference file Application which I am pretty sure was ...
0
votes
1answer
72 views

Setting time and date without using NTP

I have a "windriver" linux based Wimax ASN, and when ever I login, I find the date and time is wrong (example: "15 jul 2010"). Whenever I set both the date and time with the date command, or the ...
3
votes
3answers
22 views

jump to current day's directory in a date based directory hierachy?

I have a pretty standard directory higherachy, year, month, date, for log files. If I want to go to todays logs I have to type cd logs/2015/12/16/ By itself this wouldn't be bad, but since I ...
3
votes
1answer
53 views

How to I convert month name to number in BSD date?

I have found solutions for GNU date, but not for BSD date. I would rather not make an if, etc. before I know if there's a built in way.
1
vote
1answer
96 views

How to extract date and calculate if it is within “x” days from today?

Currently I have file with structure as Foo Sign: blah SubFoo Sign: blah BarDate: 2017-11-31 Foo Sign: blah BarDate: Never Foo Sign: blah BarDate: 2016-12-20 Foo Sign: blah ...