perl -MDate::Manip -le 'print "Last day" if UnixDate (ParseDate ($ARGV [0]), "%B") ne UnixDate DateCalc ($ARGV [0], "1day"), "%B"' YYYYMMDD