Numbers of Days

A silly reason that I like databases, and SQL…

Herself asked me “How many days between 1st January and August 10th?” – for reasons beyond comprehension.

Normally, something like this would involve figuring out how many weeks, or counting weeks/days in a diary or whatever.

In SQL, it’s a simple “SELECT DATEDIFF(‘2009-01-01′,’2009-08-10’)” and lo, you have the answer. (221 days, if anyone cared)



Leave a Reply

Your email address will not be published. Required fields are marked *