Convert Database String to DateTime

When debugging database datetime in my apps, I like to sometimes fake the data going to the database.  Heres a code snippet that converts a database string to a DateTime object.

 

DateTime testDate = DateTime.ParseExact("2006-10-20 15:53:25.047", "yyyy-MM-dd HH:mm:ss.fff", null)

 

 

 

More string conversions can be found in my post DateTime.ToString() Patterns

1 Comment

Comments have been disabled for this content.