I am trying to create a unique ID for each record based on the date the record is created. Example, if the record is created today, I want the key to be 20101130XX where XX
This approach simply won't work because @Charles is true. You can't rely on a timestamp because there's a chance of duplicates (collision).
Create a simple autoincrement id then save the timestamp too and you'll be happy.