[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

How to get the number of seconds since .....

Posted on 1999-11-21
4
Medium Priority
?
265 Views
Last Modified: 2010-03-05
Hi,

How do I get the number of seconds which has elapsed since a given date until the current date ?

Hoping very much that someone can help out.

Thx
Dave
0
Comment
Question by:dgb001
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
jsatterl earned 200 total points
ID: 2223577
The following perl code should do
what you want:

use Time::Local;
my @first_date = ($sec,$min,$hour,$day,$month,$year);
my $first_date = timelocal(@first_date);

## if the current date is not right now
my @second_date = ($sec,$min,$hour,$day,$month,$year);
my $second_date = timelocal(@second_date);

### else
my $second_date = time;

my $seconds = ($second_date - $first_date);


0
 
LVL 1

Author Comment

by:dgb001
ID: 2223605
ok, gimme a while and I'll check it out - thx
Dave
0
 
LVL 85

Expert Comment

by:ozo
ID: 2223807
@first_date = ($sec,$min,$hour,$day,$month-1,$year-1900);
0
 
LVL 1

Author Comment

by:dgb001
ID: 2223919
Thx guys.
0

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

611 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question