Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions xml/System/DateTime.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Time values are measured in 100-nanosecond units called ticks. A particular date
> [!NOTE]
> If you are working with a ticks value that you want to convert to some other time interval, such as minutes or seconds, you should use the <xref:System.TimeSpan.TicksPerDay?displayProperty=nameWithType>, <xref:System.TimeSpan.TicksPerHour?displayProperty=nameWithType>, <xref:System.TimeSpan.TicksPerMinute?displayProperty=nameWithType>, <xref:System.TimeSpan.TicksPerSecond?displayProperty=nameWithType>, or <xref:System.TimeSpan.TicksPerMillisecond?displayProperty=nameWithType> constant to perform the conversion. For example, to add the number of seconds represented by a specified number of ticks to the <xref:System.DateTime.Second%2A> component of a <xref:System.DateTime> value, you can use the expression `dateValue.Second + nTicks/Timespan.TicksPerSecond`.

You can view the source for the entire set of examples from this article in either [Visual Basic](https://github.com/dotnet/docs/tree/master/samples/snippets/visualbasic/System.DateTime/) or [C#](https://github.com/dotnet/docs/tree/master/samples/snippets/csharp/System.DateTime/) from the docs repository on GitHub.
You can view the source for the entire set of examples from this article in either [Visual Basic](https://github.com/dotnet/samples/tree/master/snippets/visualbasic/System.DateTime/) or [C#](https://github.com/dotnet/samples/tree/master/snippets/csharp/System.DateTime/) from the docs repository on GitHub.

> [!NOTE]
> An alternative to the <xref:System.DateTime> structure for working with date and time values in particular time zones is the <xref:System.DateTimeOffset> structure. The <xref:System.DateTimeOffset> structure stores date and time information in a private <xref:System.DateTime> field and the number of minutes by which that date and time differs from UTC in a private <xref:System.Int16> field. This makes it possible for a <xref:System.DateTimeOffset> value to reflect the time in a particular time zone, whereas a <xref:System.DateTime> value can unambiguously reflect only UTC and the local time zone's time. For a discussion about when to use the <xref:System.DateTime> structure or the <xref:System.DateTimeOffset> structure when working with date and time values, see [Choosing Between DateTime, DateTimeOffset, TimeSpan, and TimeZoneInfo](~/docs/standard/datetime/choosing-between-datetime.md).
Expand Down Expand Up @@ -416,7 +416,7 @@ The previous examples all assumed that <xref:System.DateTime> values are express
[!code-vb[System.DateTime.Persistence#6](~/samples/snippets/visualbasic/System.DateTime/DateWithTimeZone.vb#6)]

> [!IMPORTANT]
> The `DateWithTimeZone` structure is used in the next two examples, which serialize and deserialize an array of `DateWithTimeZone` objects. You can view the source for the entire set of examples from this article in either [Visual Basic](https://github.com/dotnet/docs/tree/master/samples/snippets/visualbasic/System.DateTime/) or [C#](https://github.com/dotnet/docs/tree/master/samples/snippets/csharp/System.DateTime/) from the docs repository on GitHub.
> The `DateWithTimeZone` structure is used in the next two examples, which serialize and deserialize an array of `DateWithTimeZone` objects. You can view the source for the entire set of examples from this article in either [Visual Basic](https://github.com/dotnet/samples/tree/master/snippets/visualbasic/System.DateTime/) or [C#](https://github.com/dotnet/samples/tree/master/snippets/csharp/System.DateTime/) from the docs repository on GitHub.

By using the `DateWithTimeZone` structure, you can then persist date and time along with time zone information. The following example uses the <xref:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter> class to serialize an array of `DateWithTimeZone` objects.

Expand Down