What exactly is it you need this for? It sounds to me like you will need to use an actual programming language; using (for example) C# makes it pretty easy:
DateTime yesterday = DateTime.Today.AddDays(-1.0);
You can then use the Day, Month, etc properties to get the actual information you need. It's extremely simple. In fact, I think the hardest part will be getting the information to your batch file, though piping or using the errorlevel may serve the purpose.