Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,39 +1,48 @@
// The following code example gets the minimum date and the maximum date of the calendar.

// <snippet1>
using System;
using System.Globalization;

public class SamplesCalendar {

public static void Main() {

// Create an instance of the calendar.
JapaneseCalendar myCal = new JapaneseCalendar();
Console.WriteLine( myCal.ToString() );

// Create an instance of the GregorianCalendar.
GregorianCalendar myGre = new GregorianCalendar();

// Display the MinSupportedDateTime and its equivalent in the GregorianCalendar.
DateTime myMin = myCal.MinSupportedDateTime;
Console.Write( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal.GetMonth(myMin), myCal.GetDayOfMonth(myMin), myCal.GetYear(myMin) );
Console.WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre.GetMonth(myMin), myGre.GetDayOfMonth(myMin), myGre.GetYear(myMin) );

// Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar.
DateTime myMax = myCal.MaxSupportedDateTime;
Console.Write( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal.GetMonth(myMax), myCal.GetDayOfMonth(myMax), myCal.GetYear(myMax) );
Console.WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre.GetMonth(myMax), myGre.GetDayOfMonth(myMax), myGre.GetYear(myMax) );
}
}

// <snippet1>
// Create an instance of the calendar.
JapaneseCalendar myCal = new();
Console.WriteLine(myCal.ToString());

// Create an instance of the GregorianCalendar.
GregorianCalendar myGre = new();

// Display the MinSupportedDateTime and its equivalent in the GregorianCalendar.
DateTime myMin = myCal.MinSupportedDateTime;
Console.Write(
"MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}",
myCal.GetMonth(myMin),
myCal.GetDayOfMonth(myMin),
myCal.GetYear(myMin));
Console.WriteLine(
" (in Gregorian, {0:D2}/{1:D2}/{2:D4})",
myGre.GetMonth(myMin),
myGre.GetDayOfMonth(myMin),
myGre.GetYear(myMin));

// Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar.
DateTime myMax = myCal.MaxSupportedDateTime;
Console.Write(
"MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}",
myCal.GetMonth(myMax),
myCal.GetDayOfMonth(myMax),
myCal.GetYear(myMax));
Console.WriteLine(
" (in Gregorian, {0:D2}/{1:D2}/{2:D4})",
myGre.GetMonth(myMax),
myGre.GetDayOfMonth(myMax),
myGre.GetYear(myMax));

/*
This code produces the following output.
This code produces the following output on .NET 11.

System.Globalization.JapaneseCalendar
MinSupportedDateTime: 09/08/0001 (in Gregorian, 09/08/1868)
MaxSupportedDateTime: 12/31/8011 (in Gregorian, 12/31/9999)
MinSupportedDateTime: 10/23/0001 (in Gregorian, 10/23/1868)
MaxSupportedDateTime: 12/31/7981 (in Gregorian, 12/31/9999)

*/
// </snippet1>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,38 +1,51 @@
' The following code example gets the minimum date and the maximum date of the calendar.

' <snippet1>
Imports System.Globalization

Public Class SamplesCalendar

Public Shared Sub Main()

' Create an instance of the calendar.
Dim myCal As New JapaneseCalendar()
Console.WriteLine(myCal.ToString())

' Create an instance of the GregorianCalendar.
Dim myGre As New GregorianCalendar()

' Display the MinSupportedDateTime and its equivalent in the GregorianCalendar.
Dim myMin As DateTime = myCal.MinSupportedDateTime
Console.Write("MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal.GetMonth(myMin), myCal.GetDayOfMonth(myMin), myCal.GetYear(myMin))
Console.WriteLine(" (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre.GetMonth(myMin), myGre.GetDayOfMonth(myMin), myGre.GetYear(myMin))

' Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar.
Dim myMax As DateTime = myCal.MaxSupportedDateTime
Console.Write("MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal.GetMonth(myMax), myCal.GetDayOfMonth(myMax), myCal.GetYear(myMax))
Console.WriteLine(" (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre.GetMonth(myMax), myGre.GetDayOfMonth(myMax), myGre.GetYear(myMax))

End Sub
Public Class SamplesCalendar

Public Shared Sub Main()
' <snippet1>
' Create an instance of the calendar.
Dim myCal As New JapaneseCalendar()
Console.WriteLine(myCal.ToString())

' Create an instance of the GregorianCalendar.
Dim myGre As New GregorianCalendar()

' Display the MinSupportedDateTime and its equivalent in the GregorianCalendar.
Dim myMin As Date = myCal.MinSupportedDateTime
Console.Write(
"MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}",
myCal.GetMonth(myMin),
myCal.GetDayOfMonth(myMin),
myCal.GetYear(myMin))
Console.WriteLine(
" (in Gregorian, {0:D2}/{1:D2}/{2:D4})",
myGre.GetMonth(myMin),
myGre.GetDayOfMonth(myMin),
myGre.GetYear(myMin))

' Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar.
Dim myMax As Date = myCal.MaxSupportedDateTime
Console.Write(
"MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}",
myCal.GetMonth(myMax),
myCal.GetDayOfMonth(myMax),
myCal.GetYear(myMax))
Console.WriteLine(
" (in Gregorian, {0:D2}/{1:D2}/{2:D4})",
myGre.GetMonth(myMax),
myGre.GetDayOfMonth(myMax),
myGre.GetYear(myMax))

'This code produces the following output on .NET 11.
'
'System.Globalization.JapaneseCalendar
'MinSupportedDateTime: 10/23/0001 (in Gregorian, 10/23/1868)
'MaxSupportedDateTime: 12/31/7981 (in Gregorian, 12/31/9999)
' </snippet1>

End Sub

End Class


'This code produces the following output.
'
'System.Globalization.JapaneseCalendar
'MinSupportedDateTime: 09/08/0001 (in Gregorian, 09/08/1868)
'MaxSupportedDateTime: 12/31/8011 (in Gregorian, 12/31/9999)

' </snippet1>
Loading