#!/usr/bin/perl use 5.10.1; use strict; use warnings; use Date::Manip::Date; my $date1 = new Date::Manip::Date; my @dates = ('2011103003:00:00', '2011103002:00:00', '2011103001:00:00', '2011103000:00:00'); my $delta1 = $date1->new_delta(); $delta1->parse('-0:0:-0:0:1:0:0'); foreach my $date (@dates) { $date1->parse($date); my $date2 = $date1->calc($delta1); print "date: ",$date1->printf('%g')," ", "date2: ",$date2->printf('%g'),"\n"; } #### The same time yesterday with the same offest as today. If that doesn't exist, then the same time yesterday in the other offset. If that doesn't exist, then 24 hours in the past.