Thursday, December 01, 2005

Christmas calendar 1/24

Today I will talk about something I've been stumped on a few times. It's sooo easy, but it's also easy to forget, so here goes:

DateTime Accurracy

A) The .Net DateTime type holds its accurracyin ticks: each tick is 100 nanoseconds.
IE. there are 10000 ticks each millisecond.

B) The Sql DateTime type only holds accurracy down to three milliseconds.

C) The .Net DateTime Type does *not* output its milliseconds in the standard ToString()

These three points work in unison to make it hard to work with datetimes in .net. One could always just use SqlDateTime, but this datatype is hopelessly useless (no functionality).
Frequently I find I wish we just stored the ticks in the database and did the conversion manually in my current project.

No comments: