in reply to Loop through epoch days

I'd use DateTime:
$ cat 641322.pl use strict; use warnings; use DateTime; my $dt1 = DateTime->from_epoch( epoch => 1135202400 ); my $dt2 = DateTime->from_epoch( epoch => 1188252000 ); $dt1->add( hours => 2 ); # adjust to midnight while ($dt2 > $dt1){ print $dt1->ymd() . q{ } . $dt1->hms(); $dt1->add( days => 1 ); } __END__ $ perl -wl 641322.pl | head 2005-12-22 00:00:00 2005-12-23 00:00:00 2005-12-24 00:00:00 2005-12-25 00:00:00 2005-12-26 00:00:00 2005-12-27 00:00:00 2005-12-28 00:00:00 2005-12-29 00:00:00 2005-12-30 00:00:00 2005-12-31 00:00:00
--
Andreas

Replies are listed 'Best First'.
Re^2: Loop through epoch days
by Scrat (Monk) on Sep 27, 2007 at 12:06 UTC

    This is great: in your while loop you also converted the epoch values back to a character string that is compatible with MSSQL, which is exactly what I needed to do next! Thanks Andreas.