“DateTimeOffset should be considered the default date and time type for application development”

If you’re in the habit (like I was until recently) of using the DateTime data type whenever you need to represent a date, time or timestamp then I strongly recommend reading this MSDN article:

Choosing Between DateTime, DateTimeOffset, and TimeZoneInfo

The main points are:

  • Only if a DateTime value represents UTC does that value unambiguously identify a single point in time regardless of the system or time zone in which the value is used.
  • The DateTimeOffset structure represents a date and time value, together with an offset that indicates how much that value differs from UTC. Thus, the value always unambiguously identifies a single point in time.
  • The DateTimeOffset type can be used to unambiguously define the meaning of “now”, to log transaction times, to log the times of system or application events, and to record file creation and modification times.
  • These uses for DateTimeOffset values are much more common than those for DateTime values. As a result, DateTimeOffset should be considered the default date and time type for application development.

It’s worth also mentioning that recent versions of SQL Server support an equivalent type, so you can easily persist this type in databases without any conversion: datetimeoffset


Using SysInternals Process Monitor to troubleshoot permissions problems

I recently found a good use for Process Monitor which I hadn't thought of before:

If you ever have problems with software not working and you suspect it may be a permissions issue, run Process Monitor while the software is running and look for any ACCESS DENIED messages in the Result column. It's much easier than guessing the permissions you need to set.

Note: Process Monitor is an enhanced replacement for Filemon and Regmon but Filemon would still do the job.


Finally, I have a blog

I thought it was about time I gave this a go. I hope you enjoy reading it, but don’t expect anything more than a few technical notes or interesting links.

I’m using the Serendipity Weblog System


Follow

Get every new post delivered to your Inbox.