date subtraction(URGENT)


 
Thread Tools Search this Thread
Operating Systems Linux date subtraction(URGENT)
# 1  
Old 04-05-2006
date subtraction(URGENT)

Hi all,

I need the date subtraction fuctionality using shell commands.
For example:
date1:Wed Apr 5 08:35:21 IST 2006
date2:Tue Apr 4 10:35:44 IST 2006
I need the date subtraction result like " 22 hours 23 seconds".

Please guide me to complete this task.
Can you please help me ASAP.

Regards,
Uday
# 2  
Old 02-25-2008
same is my question...
experts pls help us..
Sreejith_VK
# 3  
Old 02-25-2008
Two different users posting similar questions. Looks like homework.
# 4  
Old 02-25-2008
Hi vino,

Posts are similar but the first one was in the year "2006".Smilie

This is not a home work.

I am writing a unix program which will generate a report of a process.The process is having two logs the start.log(time of start of process )and the end.log(end time of the process).

I want in my report to show the over all time of the process for that i will have to subtract the end time from start time.
I know to fetch the data from the logs.
Now i want to subtract the two dates.
The datecalc is also not working as this invloves characters.
Request expert help.
Sreejith_VK
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Urgent for date increment

hi all, i would like to increment the date variable i am using for((i=20190731;i<=20190801;i++)) do done after 20190731 it should be 20190801 but this taking as 20190732,20190733.... kindly help me to solve this (3 Replies)
Discussion started by: prathaban
3 Replies

2. UNIX for Dummies Questions & Answers

Date Subtraction

Hello All, I am a newbie to unix shell scripting and need to write a script that displays the difference between two variables that stores date value. For example, F1=`ls -ltr file1* | tail -1 |tr -s ' ' |cut -d' ' -f6,7,8` F2=`ls -ltr file2* | tail -1 |tr -s ' ' |cut -d' ' -f6,7,8` F1... (3 Replies)
Discussion started by: priyaa2010
3 Replies

3. Shell Programming and Scripting

Need Help on date subtraction

I have dates as follows in a file 20121029135649 20121029135721 20121030091540 20121030093420 20121030094340 20121030095427 20121030095856 20121030100104 20121030100251 All these dates are in sorted order. I need to find out the difference between the dates as follows 2nd row... (6 Replies)
Discussion started by: meetsriharsha
6 Replies

4. Shell Programming and Scripting

Date Subtraction with time.

HI gurus... I have a PERL file that help me extract the date and time of the file. The format of this is: yyyymmddhhmmss. Example: 20100430070935 (April 30 2010 07:09:35) How can i subtract the acquired time from system's time..?? The answer... (6 Replies)
Discussion started by: bankimmehta
6 Replies

5. Shell Programming and Scripting

Date subtraction

hi, i set up a script on my server to do a particular task once files from an external system are ftpd in the format compaq_20100110 (YYDDMM). Interestingly, the source of ftp is sending the files in the format e.g 20100109 i.e. previous date and for some reason this fails.kindly see my script... (2 Replies)
Discussion started by: bigtejus
2 Replies

6. Shell Programming and Scripting

Need to zip the files date wise --urgent Help needed

Hi all, this is my first post, i need to write a script to zip the files with datewise below are the log files. -rw------- 1 root sso 85316156 May 24 22:11 core_test_smservaz_104_104_1243217459_8896 -rw------- 1 root sso 90413304 May 25 22:12 core_test_smservaz_104_104_1243303895_20912... (4 Replies)
Discussion started by: lcschandu
4 Replies

7. UNIX for Dummies Questions & Answers

subtraction from date

hi gurus! i realize that my question shows my stupidness, but i need your help! i have: s_date=`date +%m-%d-%Y_%I%p` variable and i need the same, but minus one hour.. what i made: s_date=time(`date +%m-%d-%Y_%I%p`) - 3600 but i'm getting: daily_exports.sh: line 20: syntax error near... (4 Replies)
Discussion started by: MarGur
4 Replies

8. Shell Programming and Scripting

date arthemetic - really urgent

I get the timestamp of a file. the output of the timestamp is like this: Nov 3 11:04 I need to get the current date and subtract it from the timestamp. the output of the difference should be in minutes.. eg) (current_date-timestamp = x minutes) pls help guys.. thanks in advance (6 Replies)
Discussion started by: ragha81
6 Replies

9. Shell Programming and Scripting

date problem -- URGENT

Hi All, When i run date command at unix prompt, i get the output in format Tue Aug 29 12:36:18 GMT 2006 when i write the shell script i should be able to export the date output with format as YYYY/MM/DD-HH:MM:SS into some variable(ex : dateop). and when i say echo ${dateop} i should... (9 Replies)
Discussion started by: rkrgarlapati
9 Replies

10. Shell Programming and Scripting

Date Subtraction in KSH

I need to figure out the numeric representation of the previous month (in an automated monthly-running script) so that I may append it to a filename. I have tried statements such as variable=`date +%m -1` (and several variations) but with no success. I have also tried simply assigning the value... (3 Replies)
Discussion started by: mharley
3 Replies
Login or Register to Ask a Question