The gnu date command does a very good job of this.
http://www.gnu.org/software/coreutils/manual/html_node/Examples-of-date.html
There is a ruby library with C code that parses these kinds of time specifications.
https://github.com/bbense/ruby-getdate
This one also seems very interesting
https://github.com/mojombo/chronic
Another convention that I've seen in more than one program is to use a letter qualifier after the number to indicate units other than seconds.
2m ( 2 minutes )
2h ( 2 hours )
2d ( 2 days )
2M ( 2 months )