Calculation with DATEs

D

Dietmar Kehr

I need a procedure for calculations with dates,
e.g. let
$date1= 22 June 1960
$date2= 29 August 2004
then i would appreciate a procedure that calculates
the time-difference from $date1 until $date2 and such things.

Are there data-formats for dates and such
procedures? Where do I find them?

Best regards.
 
G

Gunnar Hjalmarsson

Dietmar said:
I need a procedure for calculations with dates,
e.g. let
$date1= 22 June 1960
$date2= 29 August 2004
then i would appreciate a procedure that calculates
the time-difference from $date1 until $date2 and such things.

Are there data-formats for dates and such
procedures?
Yes.

Where do I find them?

In the part of the docs that describes built-in functions and in CPAN.

Surprise, surprise...
 
P

Paul Lalli

Dietmar said:
I need a procedure for calculations with dates,
e.g. let
$date1= 22 June 1960
$date2= 29 August 2004
then i would appreciate a procedure that calculates
the time-difference from $date1 until $date2 and such things.

Are there data-formats for dates and such
procedures? Where do I find them?

Best regards.

Have you bothered to read the FAQ yet?

perldoc -q date
Found in /opt/perl/lib/5.6.1/pod/perlfaq4.pod
How can I compare two dates and find the difference?

Read that, follow the suggestions contained therein, and if you don't
understand or have trouble implementing the results, feel free to try
posting here again.

Paul Lalli
 
W

William James

Dietmar said:
I need a procedure for calculations with dates,
e.g. let
$date1= 22 June 1960
$date2= 29 August 2004
then i would appreciate a procedure that calculates
the time-difference from $date1 until $date2 and such things.

Since they won't help you, I'll step in. Use Ruby.

require 'date'

puts Date.new(2004,8,29) - Date.new(1960,6,22)
puts Date.new(1960,6,22) + 16139
puts Date.new(2004,8,29) - Date.new(2004,7,31)
-->
16139
2004-08-29
29
 
S

Simon Taylor

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,173
Messages
2,570,937
Members
47,481
Latest member
ElviraDoug

Latest Threads

Top