Hacker News new | ask | show | jobs
by michaelt 520 days ago
> Is it a struggle though?

It’s twelve lines or more, if you include the imports and error handling.

Spreadsheets and SQL will coerce a string to a date without even being asked to. You might want something more structured than that, but you should be able to do it in far less than 12 lines.

C has many clunky elements like this, which makes working with it like pulling teeth.

4 comments

>Spreadsheets and SQL will coerce a string to a date without even being asked to.

But only when you don't want them to, when you do want them to do it it's still a pain.

Spreadsheets and SQL will coerce a string to a date because someone programmed them to in C or C++.
almost like C is logically operating at a lower level than spreadsheets or SQL or something
> you should be able to do it in far less than 12 lines

In C++, maybe. In C, not necessarily. If you're not willing to reinvent the wheel why'd you choose C anyway?