LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 05-18-2006, 11:39 AM   #1
pshankland
Member
 
Registered: Feb 2006
Location: UK
Distribution: CentOS 5.5
Posts: 46

Rep: Reputation: 15
Adding seconds to `date +%s` ?


Am sure this is a simple one but...

I am getting the date and time value back by using `date +%s` but I need to add 7200 seconds to this (2 hours), how can I do this?

Code:
start_time=`date +%s`
duration=7200
end_time=$start_time <something here> $duration
Thanks.
 
Old 05-18-2006, 11:56 AM   #2
alunduil
Member
 
Registered: Feb 2005
Location: San Antonio, TX
Distribution: Gentoo
Posts: 684

Rep: Reputation: 62
Code:
start_time=$(date +%s)
let " finish_time = 7200 + start_time "
echo ${finish_time}
That is how I would do it.

Regards,

Alunduil
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
convert total no of seconds in the format hour minutes and seconds suchi_s Programming 15 03-15-2011 11:34 AM
Start Date + Time Duration = End Date/Time calculator? ToBe Linux - General 3 09-26-2005 10:17 AM
adding date to filename (creating a quick screenshot button) toaster.waffle Linux - Software 2 04-27-2005 03:19 AM
adding date timestamp to filename markraem Solaris / OpenSolaris 2 11-17-2004 08:32 AM
lastlog date does not match system date? jcmj Linux - Networking 6 10-22-2002 12:09 PM


All times are GMT -5. The time now is 11:45 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration