Linked Questions

6 votes
3 answers

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 ...'s user avatar
0 votes
2 answers

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" ...
Danny's user avatar
  • 175
-1 votes
1 answer

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"/...
Alaa Ismael Al's user avatar
0 votes
2 answers

extract day of the month and hour of a given date format shell scripting [duplicate]

I am writing a script where I am looking for help. I am using date format in my script as below (YYYY MM DD HH MM): $ echo $DT 202002252216 Now my requirement is to compare two dates listed in the ...
Durga's user avatar
  • 17
-3 votes
1 answer

Date difference calculation command [duplicate]

I have date in the format of 10/2/23. How can I get the difference of 10/2/23 to todays date? Please advise.
bhu's user avatar
  • 1
0 votes
1 answer

find the time difference between two strings of fixed format as "DDD MMM dd hh:mm:ss HKT YYYY" [duplicate]

I grepped from the start time and end time strings from the program log. How can I find the time difference in hour? t1="Tue Feb 21 12:15:00 HKT 2023" t2="Tue Feb 21 12:45:01 HKT 2023&...
SBMVNO's user avatar
  • 103
25 votes
11 answers

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 (...
jyz's user avatar
  • 667
11 votes
5 answers

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 ...
user328302's user avatar
11 votes
4 answers

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?
ychaouche's user avatar
  • 998
2 votes
3 answers

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 - ...
Pysis's user avatar
  • 147
2 votes
2 answers

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 ...
eptesicus's user avatar
2 votes
1 answer

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....
FredOscatore's user avatar
-1 votes
2 answers

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 "$...
Himanshu Kumar's user avatar