parsing time periods params



Hallo
Do You know any ready to use class/method that would return number of seconds, something like that:
method( "2" ) : would return 2 [secs]
method( "2s" ) : would return 2 [secs]
method( "2m" ) : would return 120 [secs]
method( "2h" ) : would return 7200 [secs]
method( "2d" ) : ...

Greetings
.