I looked all over trying to find an easy way to convert a date to a UNIX timestamp in a shell or perl script. I was disappointed that I didn't find anything that was easy, sure and didn't require extra software. Most of my UNIX scripts have to operate on Mac OS X so I don't concern myself too much about portability and generally try to use what's already available on the system.
The easiest way I found to convert a date string to a UNIX timestamp is with PHP's
strtotime function. Fortunately, PHP is included on Mac OS X machine at no extra charge!

This one-liner handles the need pretty well.
$ my_stamp=`php -r \ ¬
'fwrite(STDOUT,strtotime("2006-05-08 15:23:52"));'` ¬
$ echo $my_stamp ¬
1147127032
The constants:
STDIN,
STDOUT, and
STDERR are predefined to make life easy!
For more info, check out: "
Using PHP from the command line."