DateTime values are represented as the number of ticks (the number of 100-nanosecond intervals) that have elapsed since 12:00:00 midnight, January 1, 0001.DateTime value is independent of the way in which that value appears when displayed in a user interface element or when written to a file.DateTime value is the result of a formatting operation.
DateTime structure contains a 64-bit field composed of a private Kind field concatenated with the Ticks field.
Kind field is a 2-bit field that indicates whether the DateTime structure represents a local time, a Coordinated Universal Time (UTC), or the time in an unspecified time zone.Kind field is used when performing time conversions between time zones, but not for time comparisons or arithmetic. The value of the Kind field can be obtained with the Kind property.Ticks property expresses date and time values in units of one ten-millionth of a second, and the Millisecond property returns the thousandths of a second in a date and time value.
DateTime.Now property to measure elapsed time, and you are concerned with small time intervals less than 100 milliseconds, you should note that values returned by the DateTime.Now property are dependent on the system clock, which on Windows 7 and Windows 8 systems has a resolution of approximately 15 milliseconds.DateTime value is always expressed in the context of an explicit or default calendar.TimeSpan.TicksPerDay, TimeSpan.TicksPerHour, TimeSpan.TicksPerMinute, TimeSpan.TicksPerSecond, or TimeSpan.TicksPerMillisecond constant to perform the conversion.ParseExact and TryParseExact allow you to specify the format of the date in the containing input string before you parse the value.ParseExact() is also useful if you want to only accept one format as valid (even if it’s a standard format).ParseExact() is more efficient than Parse().IFormatProvider.
logEntryTime = DateTime.ParseExact(logString, "yyyyMMdd HHmmss", null);
logEntryTime = DateTime.ParseExact(logString, "yyyyMMdd hhmmss", DateTimeFormatInfo.CurrentInfo);
Custom Date and Time Format Strings
How to: convert strings to DateTime
TryParse and TryParseExact methods indicate whether a particular string contains a valid representation of a DateTime value in addition to performing the conversion.DateTime structure, such as Add or Subtract, does not modify the value of the structure.
DateTime structure whose value is the result of the calculation.DateTime structure itself offers limited support for converting from one time zone to another.
ToLocalTime method to convert UTC to local time, or you can use the ToUniversalTime method to convert from local time to UTC.TimeZoneInfo class.DateTime.ToString() method returns the string representation value using the current culture's short date and long time pattern.