Time difference in Minute in UNIX

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Time difference in Minute in UNIX
# 1  
Old 09-14-2009
Time difference in Minute in UNIX

is there any ways to get the time difference between 2 dates in UNIX?

for example, For below date the outut should come 22 minutes

startdate            enddate
=========            =======
06/17/2008 13:25     06/17/2008 13:47

For, below date, the output should come 1462 minutes

startdate            enddate
=========            =======
06/17/2008 13:25     06/18/2008 13:47

# 2  
Old 09-14-2009
Question covered a few times in this forum. For example here:
# 3  
Old 09-14-2009
date -d "06/17/2008 13:25" "+%s" Gives the seconds since '00:00:00 1970-01-01 UTC'
date -d "06/18/2008 13:47" "+%s" Gives the seconds since '00:00:00 1970-01-01 UTC'
Now get difference between those 2 values.
# 4  
Old 09-14-2009
Hi siba,

date -d is invalid option in Sun Solaris... can you tell me other option i can use

---------- Post updated at 04:24 PM ---------- Previous update was at 02:51 PM ----------

Hi All,

I have searched and tried all the post which are related to the calculation of datetime. but still i am not able to get the exact answer. Can someone help me to get the answer. Appreciate, your valuable help....
# 5  
Old 09-14-2009
Do you have GNU awk (gawk) on your solaris box?
# 6  
Old 09-14-2009
No, i have awk and nawk only
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Date time difference in UNIX shell script

There are 2 dates, Tue Oct 1 13:40:19 2013 Sun Sept 30 10:26:23 2013 I have multiple dates like the above one. How do I calculate the date time difference and display in another column in Shell script. Please help. (3 Replies)
Discussion started by: tanmoysays
3 Replies

2. Shell Programming and Scripting

Get the time difference between two consecutive line in UNIX perl script

Hi All :o, I have some log files which contains these informations: 2013-04-24 09:11:34.018 INFO XXXXXXXXXXXX 2013-04-24 09:11:34.029 INFO YYYYYYYYYYYY 2013-04-24 09:11:34.039 INFO ZZZZZZZZZZZZZZZ 2013-04-24 09:12:21.295 INFO TTTTTTTTTTTTTTT 2013-04-24 09:12:21.489 INFO... (3 Replies)
Discussion started by: shariquehabib
3 Replies

3. Shell Programming and Scripting

Comparing date and check minute difference

Dear all, I'm stuck on Solaris 9 bash (I believe is quite different from Linux system) trying to find a solution. I have one file named like:120629-1750-TERZ81_AS_YTR.txt YYMMDD-HH-MM-......The script should compare the actual date with the one reported on the file name and then take an action... (4 Replies)
Discussion started by: Lord Spectre
4 Replies

4. UNIX for Advanced & Expert Users

Help with Calculating time difference between many directories in UNIX

A report needs to come some what similar to this No of elements Stream Batch No Load time A B C D A,B,C im able to get quite easily wc -l /usr/local/intranet/areas/prod/output/SRGW_0?/*/MESSAGE_T.dat O/P of above command. A B C ... (1 Reply)
Discussion started by: peckenson
1 Replies

5. Shell Programming and Scripting

Difference Time Unix Shell

I have 2 variables MTIME="Jan_2_2012_23:55:49" SCH_TIME="Jan_03_2012_00:32:28" I want to find the time taken (in seconds) between MTIME and SCH_TIME. Is there any way by which this can be done in Unix Shell Script? (4 Replies)
Discussion started by: ankitncr
4 Replies

6. UNIX for Dummies Questions & Answers

How to add an hour or a minute to a time?

Hi, The timestamp is June 06 2011 11:05AM i need 2 results. first, an hour added to it, June 06 2011 12:05AM second, a minute added to it, June 06 2011 11:06AM How can i do this? Also when it reaches 12:59, it needs to start from 1 again without giving the output as 13:00. it... (17 Replies)
Discussion started by: irudayaraj
17 Replies

7. Shell Programming and Scripting

counting word xx referred to a time period, like minute or hour

Hello, I try to insert a post because I've got a trouble to perform a unix job. But I didn't found which steps (procedure) I should follow. Could you help me? I got a log by my Application box, like following: gbosmam037:test >view Log_Server.csv ... (2 Replies)
Discussion started by: maluca68
2 Replies

8. Shell Programming and Scripting

How to calculate time difference between start and end time of a process!

Hello All, I have a problem calculating the time difference between start and end timings...! the timings are given by 24hr format.. Start Date : 08/05/10 12:55 End Date : 08/09/10 06:50 above values are in mm/dd/yy hh:mm format. Now the thing is, 7th(08/07/10) and... (16 Replies)
Discussion started by: smarty86
16 Replies

9. Shell Programming and Scripting

Find Time difference in Unix

Hi, START_TIME :- "10-NOV-2009 00:00:04" STOP_TIME :- "10-NOV-2009 00:05:47" Please help to find difference between these two. Searched for the same topic but did not find an answer for the same time format :( Regards, Robin (3 Replies)
Discussion started by: robinbannis
3 Replies

10. Shell Programming and Scripting

Unix function to calcuate the difference in time

HI , I need to get the timedifference between two values... which funcation will help eg: difference betweem 19:22 and 19:43 should give 21 mins (2 Replies)
Discussion started by: savitha
2 Replies
Login or Register to Ask a Question