unix shell scripting

i have a file blah_blah_blah_yyyymmdd.dat . I need to write a shell script to extract this date and compare it with the current date. How do i do this?? Can someone provide me with the code please?

an example,

date "+%Y"

this get the current year, check the man page of date to see how to get the month and day.
as for parsing the file ,if you have bash, one way

filename=blah_blah_blah_yyyymmdd.dat
filename=${filename##*_}
filename= ${filename%*.dat}

then use if/else and equality operator to check whether they are same