in reply to How to subtract month without using module?
But if you want it more exactly, you'll have to count each day in a mont, and do a more secure substraction.my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(t +ime); $year += 1900; $mon++; # month = 0 based; if ($mon <= 6){ $mon += 6; $year -=1; }else { $mon -= 6; } print "the date minus 6 months = \" $mday - $mon - $year \"\n";
|
|---|