You need to use regexreplace first to remove the time part of the time stamp, and then the Text() function will properly transform the way you want.
=TEXT(REGEXREPLACE("date timestamp string","\d+:\d+:\d+",""),"MM")
Note: the timestamp part of the formula - may need to be altered depending on what exactly your string looks like, if you post an example of the string your starting with - I can modify the regex for you to fit that criteria
ALso if you share an example sheet - we can incorporate your DCOUNTA or a COUNTIF alternative