You already know how to format a Date using any format you like. In fact you just posted an example of how to do it there. That's how you do it.
But don't say things like "the database formats a Date in such a way". It may have a default that it uses if a client asks it to display a Date in some string format, but that doesn't mean you have to do that. Don't do that. Get the column from the database as a Date and format it yourself. Which you already know how to do.
permaculture is largely about replacing oil with people. And one tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop