What are some issues that may arise when using dates and working with databases? [Print this FAQ]
Answer:
One of the trickiest parts for developers when using databases is working with date fields. I think every developer has, at one time or another, spent more time than he or she would like to admit trying to get a date field into the right syntax, or properly formatting a SQL string that contained a date field. Things only become more complicated when working outside of North America, where date formats are often represented as dd/mm/yyyy as opposed to the more-American way of: mm/dd/yyyy.
There are already a number of articles on 4Guys and ASPFAQs.com so this FAQ will list the most useful articles for learning about how to work with dates and squeeze them into the right format!
Working with Dates and Databases - Related Articles: -- If you are wanting a simple way to format dates into a standard that is accepted by both Microsoft Access and Microsoft SQL Server, check out Doug Dean's article: How To Code For Compatible Date Formats for Access and SQL Server.
-- If you are working with dates in the non-North American standard (that is, if you are working with dates in dd/mm/yyyy format instead of mm/dd/yyyy format) be sure to check out Darren Neimke's article: Working with Databases and International Date Formats.
-- If you need to retrieve records based on those who have a date/time column that falls within a certain range, check out this FAQ by Bill Wilkinson.
If you know of any other good date/databases-related articles be sure to let me know!
Do you have a FAQ you'd like to suggest?
Suggestions? Comments? If so, send it in!
Also, if you'd like to be a FAQ Admin (creating/editing FAQs),
let me know! If you are looking for other FAQs, be
sure to check out the 4Guys
FAQ and Commonly Asked Messageboard Questions!