Article 51XX1 CodeSOD: The Date Wrapper

CodeSOD: The Date Wrapper

by
Remy Porter
from The Daily WTF on (#51XX1)

As we've harped upon many, many, many, many, many, many times: writing your own date functions is bad. Use the built-ins or a library or anything but your own awful string-mangling date code.

But you can and should wrap the date handling stuff in your own functions as convenient. That's just good programming.

Krystian S inherited some code, which wraps date handling functions in its own abstractions, with method names like:

convertHHcolonMMtoHHcolonMMcolonSS(value);convertDDdMMdYYYtoYYYYminusMMminusDD(value);convertDDdMMdYYYspHHcolonMMtoYYYminusMMminusDDspHHcolonMMcolonSS(value);

That's a lot of stray date formatting codes mixed with colons. If your colon is getting that jammed up, you might want to talk to a doctor.

proget-icon.png [Advertisement] ProGet supports your applications, Docker containers, and third-party packages, allowing you to enforce quality standards across all components. Download and see how! TheDailyWtf?d=yIl2AUoC8zA2r1jtEFQdzE
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments