in reply to How to subtract month without using module?
If possible use modules for tricky issues like date/time. You need to worry about daylight saving etc.
#!/usr/bin/perl my $sixmthb4= time() - ( 24 * 60 * 60 * 30.5 * 6); # assuming 30.5 da +ys on avg. ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($six +mthb4); print ("Month = ", $mon +1, " Day = $mday, Year = ",$year+1900,"\n");
|
|---|