Personal and Professional growth captured on a blog

This is silly, each browser Culture (‘en-US’ or ‘en-CA’) define dates differently

I have a function call to a stored procedure, and it kept failing (exception thrown: Invalid Value NVARCHAR). After rigorousness testing I found that browser Culture is to culprit. I found that “en-CA” date format was different from “en-US“. The “en-CA” was sending the wrong date format to my stored procedure thus it kept failing.

“en-CA“: 14/04/2011
“en-US“: 4/14/2011

So here is a fix, this can be global (BasePage.cs) or just for a single page (page.aspx.cs).