Find hours difference between two dates in given format


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find hours difference between two dates in given format
# 1  
Old 05-17-2017
Question Find hours difference between two dates in given format

I have two dates in below format, how would I find the hours difference between the two dates. Im using AIX and ksh.

Code:
Current date : Wed May 17 14:34:41 SGT 2017
File date    : Thu Apr 27 20:52:41 SGT 2017

# 2  
Old 05-17-2017
Hi.

Our forum rules are that you should search the forums before posting a question:

If you search the forums for "find the hours difference between the two dates" you will find many posts at unix.com related to this question.
# 3  
Old 05-17-2017
Question

I checked it already, but couldn't find the appropriate answer to it.
Could I please find an answer to this ?
# 4  
Old 05-17-2017
Quote:
Originally Posted by simpltyansh
I checked it already, but couldn't find the appropriate answer to it.
Could I please find an answer to this ?
How about looking at the bottom of this thread for the section/table labled: "More UNIX and Linux Forum Topics You Might Find Helpful" - there're plenty of related threads.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to find the difference between epoc dates in HH:MM:SS?

How to find the difference between below epoc dates in HH:MM:SS 1557863573 converts to Tuesday May 14, 2019 21:52:53 (pm) in time zone Europe/Amsterdam (CEST) 1557866394 converts to Tuesday May 14, 2019 22:39:54 (pm) in time zone Europe/Amsterdam (CEST) #!/bin/bash set -x A=1557863573... (4 Replies)
Discussion started by: abhaydas
4 Replies

2. Fedora

Difference of dates

I have a script which is printing date in below format while writing the logs. theDate=`date +"%m%d%Y"` theTime=`date +"%H%M%S"` echo $theDate $theTime How can i find out difference current time and above format. Appreciate your help. (6 Replies)
Discussion started by: srikanth38
6 Replies

3. UNIX for Advanced & Expert Users

How to get ALL update dates and hours of a file?

Hello, I have a question please, How could I get ALL update dates and hours of a file ? For example: I modified a file on 09/04/2014 at 7:am for the first time. Then, I modified again the same file on 09/04/2014 at 9 am and finally, I modified the same file again on 10/04/2014 at... (3 Replies)
Discussion started by: nurinolo
3 Replies

4. Shell Programming and Scripting

Difference between 2 dates

Hi Friends, I have a file that has the contents like below: file1.txt 5,13/07/2013 23:25:25,14/07/2013 19:40:21 5,13/07/2013 23:25:25,14/07/2013 19:40:43 5,12/07/2013 23:50:50,13/07/2013 20:30:26 5,12/07/2013 23:20:24,13/07/2013 19:40:53 60,14/07/2013 00:00:00,14/07/2013 23:00:39... (5 Replies)
Discussion started by: vsachan
5 Replies

5. Shell Programming and Scripting

Date difference between 2 dates in 'yyyy-mm-dd hh:mm:ss' format

Hi all, I know this may have already been asked but hey ho... i have two dates in the 'yyyy-mm-dd hh:mm:ss' format. '2009-01-03 01:00:00' '2009-04-05 00:00:00' How can i, in shell script determine their differences? Please note, the time may not be available, so please suggest both... (4 Replies)
Discussion started by: muay_tb
4 Replies

6. Shell Programming and Scripting

Need script to generate all the dates in DDMMYY format between 2 dates

Hello friends, I am looking for a script or method that can display all the dates between any 2 given dates. Input: Date 1 290109 Date 2 010209 Output: 300109 310109 Please help me. Thanks. :):confused: (2 Replies)
Discussion started by: frozensmilz
2 Replies

7. Shell Programming and Scripting

Difference between two dates.

Hi all. My question may seems to be similar to one that already been here. But i need a little other solution. I have two dates in format dd/mm/yyyy. I need to find number of days between them. I need to do it in bash script. I am running on Solaris machine and have cutted 'date' command version... (1 Reply)
Discussion started by: kukuruku
1 Replies

8. Shell Programming and Scripting

How to calculate specific hours between 2 dates

Hi there, I am trying to find out a way to calculate how many hours are between 2 dates but from a specific time range, actually working hours (Monday to Friday 09:00 - 18:00). What I mean is for example date1 = Monday 21 July 2008 22:00:00 so in python 2008-07-21 22:00:00 date2 = Wednesday... (5 Replies)
Discussion started by: sickboy
5 Replies

9. Shell Programming and Scripting

Difference in day-hours-minutes-seconds format

Hi experts, I am reading two log files and passing dates as output to a txt file. Code is given below: echo "Start Time:" >> Report.txt cat start.log | while read LINE1 do echo $DATE1 >> Report.txt done echo "End Time:" >> Report.txt cat end.log | while read LINE2 ... (7 Replies)
Discussion started by: Sreejith_VK
7 Replies

10. Shell Programming and Scripting

Difference between two dates...

Hi All, Wish you a Happy New year... I have to find the difference between two dates, the result should be the number of days. I have seen the "datecalc" function. Its good, can I have any other alternative. Thanks in Advance Raju (4 Replies)
Discussion started by: rajus19
4 Replies
Login or Register to Ask a Question