Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions docs/standard/datetime/working-with-calendars.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ The following example changes the calendar used by the Arabic (Saudi Arabia) cul
[!code-csharp[Conceptual.Calendars#2](../../../samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/changecalendar2.cs#2)]
[!code-vb[Conceptual.Calendars#2](../../../samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.calendars/vb/changecalendar2.vb#2)]

Before writing to the console, it's format is changed to UTF8 so that arabic letters can be displayed correctly.

## Dates and calendars

With the exception of the constructors that include a parameter of type <xref:System.Globalization.Calendar> and allow the elements of a date (that is, the month, the day, and the year) to reflect values in a designated calendar, both <xref:System.DateTime> and <xref:System.DateTimeOffset> values are always based on the Gregorian calendar. This means, for example, that the <xref:System.DateTime.Year?displayProperty=nameWithType> property returns the year in the Gregorian calendar, and the <xref:System.DateTime.Day?displayProperty=nameWithType> property returns the day of the month in the Gregorian calendar.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public static void Main()
{
DateTime date1 = new DateTime(2011, 6, 20);

Console.OutputEncoding = Encoding.UTF8;
DisplayCurrentInfo();
// Display the date using the current culture and calendar.
Console.WriteLine(date1.ToString("d"));
Expand Down
Loading