#!/usr/bin/perl -w use strict; use Time::Local; use POSIX 'strftime'; my @now = localtime; $now[4]++; if ($now[4] == 12) { $now[4] = 0; $now[5]++; } $now[3] = 1; my @then = localtime(timelocal(0, 0, 12, @now[3 .. 5]) - 86_400); print strftime '%Y-%m-%d', @then;