in reply to Re: How to get time in seconds from localtime(time) to next 21st date of the month?
in thread How to get time in seconds from localtime(time) to next 21st date of the month?
Directly hacking the Date::Manip date format to stick a 21 in the day field is ugly, but couldn't remember how to do it with the API.#!/usr/bin/perl use strict; use warnings; use Date::Manip; my $now = ParseDate 'now'; my $then = ParseDate 'next month'; substr($then,6,2) = 21; my $delta = DateCalc $now, $then; my $seconds = Delta_Format $delta, 0, '%sh'; print "seconds=$seconds days=", $seconds/(60*60*24), "\n";
|
|---|