Here’s another amusing method I recently found in some production code which comes straight from the “can’t be bothered to learn the framework (or how to Google)” style of programming:
I wonder what the significance of 1969 is? Year of the author's birth, perhaps?!
Aside from being hacky, there is a performance implication to unnecessarily creating new DateTime objects and performing string formatting in this way. In my tests, I’ve found that this method is around 18 times slower than simply calling