I finished about 2 minutes after sam posted, but anyway
python code:
import sys,os,time
year=time.localtime()[0]
month=time.localtime()[1]
date=time.localtime()[2]
hour=time.localtime()[3]
mins=time.localtime()[4]
if hour >=12 and hour<23:
hour=hour-12
med="pm"
else:med="am"
os.rename(sys.argv[1],"%s.%s.%s-%s.%s.%s-"%(month,date,year,hour,mins,med)+sys.argv[1])