Linked Questions

3
votes
3answers
18k views

Date Difference Calculation [duplicate]

I am looking to calculate time difference between the two below Value1=2016-10-13 14:19:23 Value2=2016-10-13 18:19:23 I want to get difference in the form of hours/minutes. Any quick solution ...
0
votes
2answers
2k views

Bash time subtraction [duplicate]

I have two time variables in bash. I am trying to find a way to get the time difference between the two. Yes, I have read many many many examples on the net, but they do not seem to have a "simple" ...
0
votes
1answer
828 views

calendar different between 2 dates [duplicate]

Convert your days alive to use dialog command and a calendar for date of birth select and current date Hint: dialog --stdout --title "Today" --calendar "today" 0 0 0 0 0 | awk -F/ '{ print $2"/"$1"/...
0
votes
0answers
49 views

Find the difference between 2 dates [duplicate]

Job1 07/09/2018 22:40:57 01/20/2019 11:48:52 Job2 11/28/2018 19:23:49 01/20/2019 05:29:49 Job3 10/10/2018 01:51:52 01/19/2019 23:08:13 Job4 12/08/2018 20:51:34 01/19/2019 22:04:26 Job5 12/...
22
votes
11answers
20k views

Tool in UNIX to subtract dates

Is there any tool in Solaris UNIX (so no GNU tool available) to subtract dates? I know that in Linux we have gawk that can subtract one date from another. But in Solaris the maximum we have is nawk (...
11
votes
4answers
3k views

What's a smart way to count the number of days since X?

I started working at my current position since November 17th 2014. I would like to know how many days have run up to now. Any ideas on how to use Linux to come up with a simple and nice solution?
5
votes
2answers
2k views

Subtract time using bash?

Is it possible to use bash to subtract variables containing 24-hour time? #!/bin/bash var1="23:30" # 11:30pm var2="20:00" # 08:00pm echo "$(expr $var1 - $var2)" Running it produces the following ...
1
vote
3answers
928 views

How can I calculate and format a date duration using GNU tools, not a result date?

All of the tons of articles I have found so far all seemed to be focused on obtaining a resulting date, which is still useful, but not what I want in this case. Example link: Unix & Linux SE - ...
2
votes
1answer
370 views

Accumulate Filename in a Log file using shell script

I have files with their names as ABC_-_123321.20140505_-_161500.CSV ABC_-_654145.20140506_-_135020.CSV String_-_SerialID.Date_-_Time.CSV StartDate, StartTime, EndDate and EndTime are given as input....
1
vote
1answer
216 views

Calculate Difference In Time Over Several Days

I've seen many questions and examples showing how to calculate the difference in two times by converting the times to epoch, and then converting the difference in seconds... However, what is the best ...
-1
votes
2answers
39 views

How to get the difference between modified date and current date in shell script? [closed]

#!/bin/bash echo "hi" path="/home/alert/VideoApplicationAPI.v1/logs" dayDiff=365 DATE=`date +%Y-%m-%d` for filename in $path/*.*; do modDate=$(stat -c %y "$filename") #modDate=$(date -r "$...