Working with Dates and Times
Dates are a rather unique type of data. In some ways, they act like strings in which you can concatenate and parse pieces. In other ways, dates seem more like numbers in that you can add to or subtract from them. Although you'll often perform math-type functions on dates (such as adding a number of days to a date or determining the number of months between two dates), you don't use the typical arithmetic operations. Instead, you use functions specifically designed for working with dates.
Understanding the DateTime Data Type
Working with dates is very common. No matter the application, you'll probably need to create a variable to hold a date using the DateTime data type. You can get a date into a DateTime variable ...
Get Sams Teach Yourself Microsoft® Visual C#™ .NET in 24 Hours now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.