in reply to Calculating between times
Chris#!/usr/bin/perl use strict; use warnings; use Time::Local; my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); printf("Today's date is: %02d.%02d.%02d\n", $mon+1, $mday, $year % 100); my $date = "12.25.03"; my ($m,$d,$y) = split /\./, $date; my $xmas_time = timelocal(0,0,0,$d,$m-1,$y); my $today = time; my $days_diff = int( ($today - $xmas_time) / (24*60*60) ); print "Difference is $days_diff days\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Calculating between times
by Anonymous Monk on Jan 09, 2004 at 05:24 UTC | |
by BUU (Prior) on Jan 09, 2004 at 06:06 UTC | |
by greenFox (Vicar) on Jan 09, 2004 at 06:33 UTC | |
by Anonymous Monk on Jan 09, 2004 at 06:43 UTC | |
by BUU (Prior) on Jan 09, 2004 at 07:55 UTC | |
by Skylark (Beadle) on Jan 09, 2004 at 14:42 UTC |