I have a WinForms application that was written in C# .NET 3.5. This application interacts with a SQL Server 2008. Whenever I add a record into the database, I have a DateAdd column that I insert DateTime.Now into. For whatever reason, I have 4 records with odd dates:
'1980-01-03 23:08:43.970'
'1980-01-03 23:08:44.157'
'1980-01-03 23:08:44.530'
'1980-01-03 23:08:45.547'
The records before and after these all have proper dates of '2011-05-29 XX:XX:XX.XXX'. Users have no access to modify the date fields in any application.
Is there any reason that the dates would change like this? Users have no access to modify their system time, which I’m assuming is where DateTime.Now gathers the date from.
Basically, I’ve come to the conclusion that there is either a bug, or a user has a Delorean fully equipped with a flux capacitor…
If this is a client windows app, check the system time on the machines that the users in question are using. Also, I don’t know if this is best practice or not, but I find it easier to maintain if I use GetDate() in SQLSERVER rather than passing the date from the C#.NET application in cases were I need to record the current time.