Date and time Arithmetic


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Date and time Arithmetic
# 1  
Old 06-22-2010
Date and time Arithmetic

Hi,

I need to process a file which contains below data. Usually the files contains both Start and Finish time. but for Few records, it contains only Start. For those records I need to add the finish line by adding 5 minutes to Start time.

Code:
Started BBIDX Tue Jun 1 15:15:11 EDT 2010 292308 indx_extbo_euro.px.20100601
Finished BBIDX Tue Jun 1 15:24:47 EDT 2010 292308 indx_extbo_euro.px.20100601
Started BBID Tue Jun 1 23:55:11 EDT 2010 292308 indx_extbo_euro.px.20100601

For example in above BBID does not have Finish time, So I need to 5 minutes to start tiem so the tne new line would be


Code:
Finished BBID Wed Jun 2 00:00:11 EDT 2010 292308 indx_extbo_euro.px.20100601

Can Any one please help me. It contains some Date and time Arithemetic. I am confused where to start.
# 2  
Old 06-22-2010
have a look at the FAQ article:

https://www.unix.com/answers-frequent...rithmetic.html

;-)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help with date arithmetic please

Hello fellow forum members, I wrote below piece of code to calculate the date after a given date - date=$DATE_FINAL declare -a max_month=(0 31 28 31 30 31 30 31 31 30 31 30 31) eval $(echo $date|sed 's!\(....\)\(..\)\(..\)!year=\1;month=\2;day=\3!') (( year4=year%4 )) (( year100=year%100... (9 Replies)
Discussion started by: ektubbe
9 Replies

2. Shell Programming and Scripting

Displaying current date time of EDT in IST time

Hi Folks, My server time is in EDT. And i am sending automated mails from that server in which i need to display the current date time as per IST (GMT+5:30). Please advice how to display the date time as per IST. IST time leads 9:30 mins to EDT. and i wrote something like below. ... (6 Replies)
Discussion started by: Showdown
6 Replies

3. Shell Programming and Scripting

Adding time to date time in UNIX shell scipting

I needed some help in adding a duration (in seconds) to a start time (in hhmmss format) and a start date (in mmddyy format) in order to get an end date and end time. The concept of a leap year is also to be considered while incrementing the day. The code/ function that I have formed so far is as... (3 Replies)
Discussion started by: codehelp04
3 Replies

4. Solaris

modifying date and time and time zone on solaris 5.10 with (redundant server) veritas

I have a cluster of two Solaris server (veritas cluster). one working and the other is standby I am going to change the date on them , and am looking for a secure solution as it is giving an important service. my opinion is that the active one doesn't need to be restarted (if I don't change the... (1 Reply)
Discussion started by: barry1946
1 Replies

5. UNIX for Dummies Questions & Answers

Converting string date time to unix time in AWK

I'd like to convert a date string in the form of sun aug 19 09:03:10 EDT 2012, to unixtime timestamp using awk. I tried This is how each line of the file looks like, different date and time in this format Sun Aug 19 08:33:45 EDT 2012, user1(108.6.217.236) all: test on the 17th ... (2 Replies)
Discussion started by: bkkid
2 Replies

6. Shell Programming and Scripting

Help needed with some date arithmetic

I have a file (main.lst) containing a list of dates in DDMMYYYY format. The dates will mostly be the same but it is possible to have multiple dates and these need not be in chronological order. I have another file containing another list of dates (holidays.lst). The task is to get the latest... (5 Replies)
Discussion started by: elixir_sinari
5 Replies

7. Post Here to Contact Site Administrators and Moderators

Broken link FAQ date arithmetic with shell

page unix com/answers-frequently-asked-questions/13785-yesterdays-date-date-arithmetic.html Date Arithmetic with the Shell has link of www samag com/documents/s=8284/sam0307b/0307b.htm which is no longer. Is this the correct place to post this?:confused: and I got message... (1 Reply)
Discussion started by: dgerman
1 Replies

8. Shell Programming and Scripting

Convert Epoch Time to Standard Date and Time & Vice Versa

Hi guys, I know that this topic has been discuss numerous times, and I have search the net and this forum for it. However, non able to address the problem I faced so far. I am on Solaris Platform and unable to install additional packages like the GNU date and gawk to make use of their... (5 Replies)
Discussion started by: DrivesMeCrazy
5 Replies

9. Shell Programming and Scripting

How to perform arithmetic operation on date

Hi all, I would appreciate if anyone knows how to perform adding to date. As for normal date, i can easily plus with any number. But when it comes to month end say for example 28 Jun, i need to perform a plus with number 3, it will not return 1 Jul. Thanks in advance for your help. (4 Replies)
Discussion started by: agathaeleanor
4 Replies

10. UNIX for Advanced & Expert Users

time arithmetic

Can anyone help please. I am writing a kourne shell script and I am unsure how to do the following: I have extracted a time string from a logfile, and I have another time string I want to compare it to to see if it's later than the time I'm comparing with. i.e. expectedSLA="23:00:00", ... (2 Replies)
Discussion started by: csong2
2 Replies
Login or Register to Ask a Question