1164 instantiations of DateTime
Aspire.Dashboard.Components.Tests (4)
Aspire.Dashboard.Tests (36)
ConsoleLogsTests\LogEntriesTests.cs (3)
66new DateTime(2020, 1, 1, 0, 0, 0, DateTimeKind.Utc),
67new DateTime(2020, 1, 1, 0, 0, 0, DateTimeKind.Utc)));
70var pauseEntry = LogEntry.CreatePause("resource-name", new DateTime(2024, 1, 1, 0, 0, 0, DateTimeKind.Utc));
Model\ConsoleLogsFiltersTests.cs (2)
18FilterAllLogsDate = new DateTime(2023, 1, 2, 3, 4, 5, DateTimeKind.Utc),
21["test-abc"] = new DateTime(2023, 1, 2, 3, 4, 5, DateTimeKind.Utc)
Model\SpanWaterfallViewModelTests.cs (11)
28trace.AddSpan(TelemetryTestHelpers.CreateOtlpSpan(app1, trace, scope, spanId: "1", parentSpanId: null, startDate: new DateTime(2001, 1, 1, 1, 1, 2, DateTimeKind.Utc)));
29trace.AddSpan(TelemetryTestHelpers.CreateOtlpSpan(app2, trace, scope, spanId: "1-1", parentSpanId: "1", startDate: new DateTime(2001, 1, 1, 1, 1, 3, DateTimeKind.Utc)));
56var date = new DateTime(2001, 1, 1, 1, 1, 2, DateTimeKind.Utc);
88trace.AddSpan(TelemetryTestHelpers.CreateOtlpSpan(app1, trace, scope, spanId: "1", parentSpanId: null, startDate: new DateTime(2001, 1, 1, 1, 1, 2, DateTimeKind.Utc), kind: OtlpSpanKind.Client, attributes: [KeyValuePair.Create("http.url", "http://localhost:59267/6eed7c2dedc14419901b813e8fe87a86/getScriptTag"), KeyValuePair.Create("server.address", "localhost")]));
89trace.AddSpan(TelemetryTestHelpers.CreateOtlpSpan(app2, trace, scope, spanId: "2", parentSpanId: null, startDate: new DateTime(2001, 2, 1, 1, 1, 2, DateTimeKind.Utc), kind: OtlpSpanKind.Client));
134startDate: new DateTime(2001, 1, 1, 1, 1, 2, DateTimeKind.Utc),
194startDate: new DateTime(2001, 1, 1, 1, 1, 2, DateTimeKind.Utc),
232var parentSpan = TelemetryTestHelpers.CreateOtlpSpan(app1, trace, scope, spanId: "parent", parentSpanId: null, startDate: new DateTime(2001, 1, 1, 1, 1, 2, DateTimeKind.Utc));
233var childSpan = TelemetryTestHelpers.CreateOtlpSpan(app1, trace, scope, spanId: "child", parentSpanId: "parent", startDate: new DateTime(2001, 1, 1, 1, 1, 3, DateTimeKind.Utc));
254var parentSpan = TelemetryTestHelpers.CreateOtlpSpan(app1, trace, scope, spanId: "parent", parentSpanId: null, startDate: new DateTime(2001, 1, 1, 1, 1, 2, DateTimeKind.Utc));
255var childSpan = TelemetryTestHelpers.CreateOtlpSpan(app1, trace, scope, spanId: "child", parentSpanId: "parent", startDate: new DateTime(2001, 1, 1, 1, 1, 3, DateTimeKind.Utc));
Model\TraceHelpersTests.cs (11)
22trace.AddSpan(TelemetryTestHelpers.CreateOtlpSpan(app1, trace, scope, spanId: "1", parentSpanId: null, startDate: new DateTime(2001, 1, 1, 1, 1, 1, DateTimeKind.Utc)));
44trace.AddSpan(TelemetryTestHelpers.CreateOtlpSpan(app2, trace, scope, spanId: "1-2", parentSpanId: "1", startDate: new DateTime(2001, 1, 1, 1, 1, 2, DateTimeKind.Utc)));
45trace.AddSpan(TelemetryTestHelpers.CreateOtlpSpan(app1, trace, scope, spanId: "1-1", parentSpanId: "1", startDate: new DateTime(2001, 1, 1, 1, 1, 1, DateTimeKind.Utc)));
71trace.AddSpan(TelemetryTestHelpers.CreateOtlpSpan(app1, trace, scope, spanId: "1", parentSpanId: null, startDate: new DateTime(2001, 1, 1, 1, 1, 2, DateTimeKind.Utc)));
72trace.AddSpan(TelemetryTestHelpers.CreateOtlpSpan(app2, trace, scope, spanId: "1-1", parentSpanId: "1", startDate: new DateTime(2001, 1, 1, 1, 1, 1, DateTimeKind.Utc)));
99trace.AddSpan(TelemetryTestHelpers.CreateOtlpSpan(app1, trace, scope, spanId: "1", parentSpanId: null, startDate: new DateTime(2001, 1, 1, 1, 1, 2, DateTimeKind.Utc)));
100trace.AddSpan(TelemetryTestHelpers.CreateOtlpSpan(app2, trace, scope, spanId: "1-1", parentSpanId: "1", startDate: new DateTime(2001, 1, 1, 1, 1, 3, DateTimeKind.Utc)));
101trace.AddSpan(TelemetryTestHelpers.CreateOtlpSpan(app3, trace, scope, spanId: "1-1-1", parentSpanId: "1-1", startDate: new DateTime(2001, 1, 1, 1, 1, 2, DateTimeKind.Utc)));
102trace.AddSpan(TelemetryTestHelpers.CreateOtlpSpan(app3, trace, scope, spanId: "1-2", parentSpanId: "1", startDate: new DateTime(2001, 1, 1, 1, 1, 2, DateTimeKind.Utc)));
133trace.AddSpan(TelemetryTestHelpers.CreateOtlpSpan(app1, trace, scope, spanId: "1", parentSpanId: null, startDate: new DateTime(2001, 1, 1, 1, 1, 2, DateTimeKind.Utc)));
134trace.AddSpan(TelemetryTestHelpers.CreateOtlpSpan(app2, trace, scope, spanId: "1-1", parentSpanId: "1", startDate: new DateTime(2001, 1, 1, 1, 1, 3, DateTimeKind.Utc), uninstrumentedPeer: app3));
Aspire.Hosting.Tests (2)
BasicWebSite (1)
BinaryFormatTests (2)
dotnet-svcutil-lib (34)
FrameworkFork\Microsoft.Xml\Xml\BinaryXml\SqlUtils.cs (8)
832return new DateTime(yr, mnth, day, hr, min, sec, ms, DateTimeKind.Utc);
848DateTime d = new DateTime(yr, mnth, day, 0, 0, 0, DateTimeKind.Utc);
867return new DateTime(1, 1, 1, hr, min, sec, ms, DateTimeKind.Utc);
878DateTime SQLBaseDate = new DateTime(1900, 1, 1);
908DateTime dt = new DateTime(dateTicks);
917DateTime dt = new DateTime(dateTicks + timeTicks);
1088return (int)(dt.Ticks - new DateTime(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, dt.Second).Ticks);
1093return (int)(dt.Ticks - new DateTime(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, dt.Second).Ticks);
FrameworkFork\Microsoft.Xml\Xml\schema\XsdDateTime.cs (16)
138_dt = new DateTime(parser.year, parser.month, parser.day, parser.hour, parser.minute, parser.second);
336get { return (int)(_dt.Ticks - new DateTime(_dt.Year, _dt.Month, _dt.Day, _dt.Hour, _dt.Minute, _dt.Second).Ticks); }
371return new DateTime(_dt.Ticks, DateTimeKind.Utc);
374return new DateTime(_dt.Subtract(new TimeSpan(ZoneHour, ZoneMinute, 0)).Ticks, DateTimeKind.Utc);
377return new DateTime(_dt.Add(new TimeSpan(ZoneHour, ZoneMinute, 0)).Ticks, DateTimeKind.Utc);
409result = new DateTime(DateTime.Now.Year, xdt.Month, xdt.Day);
414TimeSpan addDiff = new DateTime(currentDateTime.Year, currentDateTime.Month, currentDateTime.Day) - new DateTime(xdt.Year, xdt.Month, xdt.Day);
427result = new DateTime(result.Ticks, DateTimeKind.Utc);
438return new DateTime(ticks, DateTimeKind.Local);
440result = new DateTime(ticks, DateTimeKind.Utc).ToLocalTime();
451return new DateTime(ticks, DateTimeKind.Local);
453result = new DateTime(ticks, DateTimeKind.Utc).ToLocalTime();
469dt = new DateTime(DateTime.Now.Year, xdt.Month, xdt.Day);
474TimeSpan addDiff = new DateTime(currentDateTime.Year, currentDateTime.Month, currentDateTime.Day) - new DateTime(xdt.Year, xdt.Month, xdt.Day);
dotnet-watch.Tests (3)
Microsoft.Analyzers.Local.Tests (2)
Json\JsonValueTest.cs (2)
160var now = new DateTime(2016, 1, 20, 5, 12, 33, DateTimeKind.Local);
299var now = new DateTime(2016, 1, 20, 5, 12, 33, DateTimeKind.Local);
Microsoft.AspNetCore.Authentication (1)
Microsoft.AspNetCore.Authentication.Core.Test (6)
AuthenticationPropertiesTests.cs (6)
199props.IssuedUtc = new DateTimeOffset(new DateTime(2018, 03, 21, 0, 0, 0, DateTimeKind.Utc));
200Assert.Equal(new DateTimeOffset(new DateTime(2018, 03, 21, 0, 0, 0, DateTimeKind.Utc)), props.IssuedUtc);
213props.ExpiresUtc = new DateTimeOffset(new DateTime(2018, 03, 19, 12, 34, 56, DateTimeKind.Utc));
214Assert.Equal(new DateTimeOffset(new DateTime(2018, 03, 19, 12, 34, 56, DateTimeKind.Utc)), props.ExpiresUtc);
244props.SetDateTimeOffset("foo", new DateTimeOffset(new DateTime(2018, 03, 19, 12, 34, 56, DateTimeKind.Utc)));
258var dateTimeOffset = new DateTimeOffset(new DateTime(2018, 03, 19, 12, 34, 56, DateTimeKind.Utc));
Microsoft.AspNetCore.Authentication.Test (12)
JwtBearerTests.cs (5)
975expires: new DateTime(DateTime.MaxValue.Ticks, DateTimeKind.Utc),
1081NotBefore = new DateTime(2001, 1, 15),
1082Expires = new DateTime(2000, 2, 20),
1089NotBefore = new DateTime(2045, 1, 15),
1096Expires = new DateTime(2000, 2, 20),
JwtBearerTests_Handler.cs (5)
920expires: new DateTime(DateTime.MaxValue.Ticks, DateTimeKind.Utc),
1155NotBefore = new DateTime(2001, 1, 15),
1156Expires = new DateTime(2000, 2, 20),
1163NotBefore = new DateTime(2045, 1, 15),
1170Expires = new DateTime(2000, 2, 20),
Microsoft.AspNetCore.Components.Endpoints.Tests (3)
Binding\FormDataMapperTests.cs (2)
2125{ "4/20/2023 12:56:34", typeof(DateTime?), new DateTime?(new DateTime(2023, 04, 20, 12, 56, 34))},
2210{ "4/20/2023 12:56:34", typeof(DateTime), new DateTime(2023, 04, 20, 12, 56, 34) },
Microsoft.AspNetCore.Components.Server (1)
Microsoft.AspNetCore.Components.Tests (15)
EventCallbackFactoryBinderExtensionsTest.cs (8)
393var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3);
412var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3);
432var expectedValue = new DateTime(2018, 3, 4);
452var expectedValue = new DateTime(2018, 3, 4);
471var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3);
490var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3);
510var expectedValue = new DateTime(2018, 3, 4);
530var expectedValue = new DateTime(2018, 3, 4);
Routing\QueryParameterValueSupplierTest.cs (3)
43AssertKeyValuePair<DateTime?>("NullableDateTimeVal", new DateTime(2021, 1, 2, 3, 4, 5, 678, DateTimeKind.Utc).ToLocalTime());
109AssertKeyValuePair<DateTime[]>("DateTimeVals", new[] { new DateTime(2020, 1, 2, 3, 4, 5, 678, DateTimeKind.Utc).ToLocalTime() });
117AssertKeyValuePair<DateTime?[]>("NullableDateTimeVals", new[] { new DateTime(2021, 1, 2, 3, 4, 5, 678, DateTimeKind.Utc).ToLocalTime() });
Microsoft.AspNetCore.Components.Web.Tests (1)
Microsoft.AspNetCore.Grpc.JsonTranscoding (1)
Microsoft.AspNetCore.Grpc.Swagger (1)
Microsoft.AspNetCore.Html.Abstractions.Tests (2)
Microsoft.AspNetCore.HttpLogging.Tests (2)
Microsoft.AspNetCore.Identity (1)
Microsoft.AspNetCore.Identity.Specification.Tests (1)
Microsoft.AspNetCore.Mvc.Core.Test (16)
ModelBinding\Binders\ComplexObjectModelBinderTest.cs (5)
832var dob = new DateTime(2001, 1, 1);
1026var result = ModelBindingResult.Success(new DateTime(2001, 1, 1));
1034Assert.Equal(new DateTime(2001, 1, 1), model.DateOfBirth);
1044DateOfBirth = new DateTime(1900, 1, 1)
1050var result = ModelBindingResult.Success(new DateTime(1800, 1, 1));
ModelBinding\Binders\ComplexTypeModelBinderTest.cs (5)
964var dob = new DateTime(2001, 1, 1);
1188var result = ModelBindingResult.Success(new DateTime(2001, 1, 1));
1196Assert.Equal(new DateTime(2001, 1, 1), model.DateOfBirth);
1206DateOfBirth = new DateTime(1900, 1, 1)
1212var result = ModelBindingResult.Success(new DateTime(1800, 1, 1));
Microsoft.AspNetCore.Mvc.IntegrationTests (4)
SimpleTypeModelBinderIntegrationTest.cs (2)
261Assert.Equal(new DateTime(2020, 02, 01, 0, 0, 0, DateTimeKind.Utc), model);
310Assert.Equal(new DateTime(2020, 02, 01, 0, 0, 0, DateTimeKind.Utc), model);
Microsoft.AspNetCore.Mvc.Localization.Test (4)
HtmlLocalizerTest.cs (4)
66new object[] { 10, new DateTime(2015, 10, 10) },
71new object[] { 10, new DateTime(2015, 10, 10) },
76new object[] { 10, new DateTime(2015, 10, 10) },
81new object[] { 10, new DateTime(2015, 10, 10) },
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (6)
src\Mvc\Mvc.ViewFeatures\test\Infrastructure\TempDataSerializerTestBase.cs (2)
137var value = new DateTime(2009, 1, 1, 12, 37, 43);
181var value = new DateTime(2009, 1, 1, 12, 37, 43);
Microsoft.AspNetCore.Mvc.TagHelpers.Test (4)
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (11)
Infrastructure\TempDataSerializerTestBase.cs (2)
137var value = new DateTime(2009, 1, 1, 12, 37, 43);
181var value = new DateTime(2009, 1, 1, 12, 37, 43);
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (1)
Microsoft.AspNetCore.SignalR.Common.Tests (3)
Microsoft.Build (1)
Microsoft.Build.Engine.UnitTests (66)
BackEnd\IntrinsicTask_Tests.cs (7)
1464oldFiles = ObjectModelHelpers.GetTempFiles(2, new DateTime(2005, 1, 1));
1465newFiles = ObjectModelHelpers.GetTempFiles(2, new DateTime(2006, 1, 1));
1506oldFiles = ObjectModelHelpers.GetTempFiles(2, new DateTime(2005, 1, 1));
1507newFiles = ObjectModelHelpers.GetTempFiles(2, new DateTime(2006, 1, 1));
1549oldFiles = ObjectModelHelpers.GetTempFiles(2, new DateTime(2005, 1, 1));
1550newFiles = ObjectModelHelpers.GetTempFiles(2, new DateTime(2006, 1, 1));
3555files = ObjectModelHelpers.GetTempFiles(2, new DateTime(2005, 1, 1));
BackEnd\KnownTelemetry_Tests.cs (3)
63DateTime startAt = new DateTime(2023, 01, 02, 10, 11, 22);
64DateTime innerStartAt = new DateTime(2023, 01, 02, 10, 20, 30);
65DateTime finishedAt = new DateTime(2023, 12, 13, 14, 15, 16);
BackEnd\TargetUpToDateChecker_Tests.cs (45)
640new DateTime(2000, 1, 1), /* input1 */
641new DateTime(2000, 1, 1), /* input2 */
642new DateTime(2001, 1, 1), /* output1 */
643new DateTime(2001, 1, 1), /* output2 */
654new DateTime(2002, 1, 1), /* input1 */
655new DateTime(2000, 1, 1), /* input2 */
656new DateTime(2003, 1, 1), /* output1 */
657new DateTime(2001, 1, 1), /* output2 */
668new DateTime(2000, 1, 1), /* input1 */
669new DateTime(2002, 1, 1), /* input2 */
670new DateTime(2001, 1, 1), /* output1 */
671new DateTime(2003, 1, 1), /* output2 */
682new DateTime(2000, 1, 1), /* input1 */
683new DateTime(2000, 1, 1), /* input2 */
684new DateTime(2000, 1, 1), /* output1 */
685new DateTime(2000, 1, 1), /* output2 */
697new DateTime(2000, 1, 1), /* input2 */
698new DateTime(2002, 1, 1), /* output1 */
699new DateTime(2002, 1, 1), /* output2 */
711new DateTime(2000, 1, 1), /* input1 */
713new DateTime(2002, 1, 1), /* output1 */
714new DateTime(2002, 1, 1), /* output2 */
725new DateTime(2000, 1, 1), /* input1 */
726new DateTime(2000, 1, 1), /* input2 */
727new DateTime(2002, 1, 1), /* output1 */
739new DateTime(2000, 1, 1), /* input1 */
740new DateTime(2000, 1, 1), /* input2 */
742new DateTime(2002, 1, 1), /* output2 */
754new DateTime(2000, 1, 1), /* input2 */
756new DateTime(2002, 1, 1), /* output2 */
767new DateTime(2002, 1, 1), /* input1 */
769new DateTime(2000, 1, 1), /* output1 */
770new DateTime(2002, 1, 1), /* output2 */
785new DateTime(2000, 1, 1), /* input1 */
787new DateTime(2002, 1, 1), /* output1 */
788new DateTime(2002, 1, 1), /* output2 */
803new DateTime(2000, 1, 1), /* input1 */
804new DateTime(2000, 1, 1), /* input2 */
805new DateTime(2002, 1, 1), /* output1 */
821new DateTime(2000, 1, 1), /* input1 */
822new DateTime(2003, 1, 1), /* input2 */
823new DateTime(2002, 1, 1), /* output1 */
958private static readonly DateTime Old = new DateTime(2000, 1, 1);
959private static readonly DateTime Middle = new DateTime(2001, 1, 1);
960private static readonly DateTime New = new DateTime(2002, 1, 1);
LogFormatter_Tests.cs (3)
47DateTime testTime = new DateTime(2007 /*Year*/, 08 /*Month*/, 20 /*Day*/, 10 /*Hour*/, 42 /*Minutes*/, 44 /*Seconds*/, 12 /*Milliseconds*/);
52testTime = new DateTime(2007, 08, 20, 05, 04, 03, 01);
56testTime = new DateTime(2007, 08, 20, 0, 0, 0, 0);
TerminalLogger_Tests.cs (4)
45private readonly DateTime _buildStartTime = new DateTime(2023, 3, 30, 16, 30, 0);
46private readonly DateTime _targetStartTime = new DateTime(2023, 3, 30, 16, 30, 1);
47private readonly DateTime _messageTime = new DateTime(2023, 3, 30, 16, 30, 2);
48private readonly DateTime _buildFinishTime = new DateTime(2023, 3, 30, 16, 30, 5);
Microsoft.Build.Framework (4)
Microsoft.Build.Framework.UnitTests (4)
BuildFinishedEventArgs_Tests.cs (4)
26buildFinishedEvent = new BuildFinishedEventArgs("Message", "HelpKeyword", true, new DateTime());
27buildFinishedEvent = new BuildFinishedEventArgs("{0}", "HelpKeyword", true, new DateTime(), "Message");
29buildFinishedEvent = new BuildFinishedEventArgs(null, null, true, new DateTime());
30buildFinishedEvent = new BuildFinishedEventArgs(null, null, true, new DateTime(), messageArgs: null);
Microsoft.Build.Tasks.Core (2)
Microsoft.Build.Tasks.UnitTests (2)
Microsoft.CodeAnalysis (3)
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (4)
Emit\EditAndContinue\AssemblyReferencesTests.cs (4)
593var compilation0 = CreateCompilation(source0.Tree, options: options.WithCurrentLocalTime(new DateTime(2016, 1, 1, 1, 0, 0)));
594var compilation1 = compilation0.WithSource(source1.Tree).WithOptions(options.WithCurrentLocalTime(new DateTime(2016, 1, 1, 1, 0, 10)));
595var compilation2 = compilation1.WithSource(source2.Tree).WithOptions(options.WithCurrentLocalTime(new DateTime(2016, 1, 1, 1, 0, 20)));
596var compilation3 = compilation2.WithSource(source3.Tree).WithOptions(options.WithCurrentLocalTime(new DateTime(2016, 1, 1, 1, 0, 30)));
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (7)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (3)
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (1)
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider (2)
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.Utilities (2)
Microsoft.CodeAnalysis.Test.Utilities (1)
Microsoft.CodeAnalysis.Workspaces (1)
Microsoft.Data.Analysis.Tests (18)
DataFrame.IOTests.cs (4)
561Assert.Equal(new DateTime(2020, 06, 01), dateTimeColumn[0]);
562Assert.Equal(new DateTime(2020, 06, 02), dateTimeColumn[1]);
563Assert.Equal(new DateTime(2020, 06, 03), dateTimeColumn[2]);
565Assert.Equal(new DateTime(2020, 06, 04), dateTimeColumn[4]);
DataFrameIDataViewTests.cs (7)
86Assert.Equal(new DateTime(2021, 06, 04), preview.ColumnView[13].Values[0]);
87Assert.Equal(new DateTime(2021, 06, 05), preview.ColumnView[13].Values[1]);
231Assert.Equal(new DateTime(2021, 06, 04), preview.ColumnView[13].Values[0]);
232Assert.Equal(new DateTime(2021, 06, 05), preview.ColumnView[13].Values[1]);
233Assert.Equal(new DateTime(2021, 06, 08), preview.ColumnView[13].Values[4]);
234Assert.Equal(new DateTime(), preview.ColumnView[13].Values[5]); // null row
235Assert.Equal(new DateTime(2021, 06, 10), preview.ColumnView[13].Values[6]);
DataFrameTests.Computations.cs (6)
398new DateTime(2022, 1, 1),
399new DateTime(2020, 1, 1),
400new DateTime(2023, 1, 1),
401new DateTime(2021, 1, 1),
405Assert.Equal(new DateTime(2020, 1, 1), dateTimeColumn.Min());
406Assert.Equal(new DateTime(2023, 1, 1), dateTimeColumn.Max());
Microsoft.DotNet.Build.Tasks.Installers (3)
Microsoft.DotNet.Build.Tasks.Packaging.Tests (1)
Microsoft.DotNet.SourceBuild.Tasks (1)
Microsoft.DotNet.XUnitAssert.Tests (14)
EqualityAssertsTests.cs (8)
1727 var expected = new DateTime(2023, 2, 11, 15, 4, 0);
1728 var actual = new DateTime(2023, 2, 11, 15, 4, 0);
1740 var expected = new DateTime(2023, 2, 11, 15, 4, 0);
1741 var actual = new DateTime(2023, 2, 11, 15, 5, 0);
1760 var date1 = new DateTime(2023, 2, 11, 15, 4, 0);
1761 var date2 = new DateTime(2023, 2, 11, 15, 5, 0);
1775 var date1 = new DateTime(2023, 2, 11, 15, 4, 0);
1776 var date2 = new DateTime(2023, 2, 11, 15, 6, 0);
EquivalenceAssertsTests.cs (6)
1448 var expected = new DateTime(2022, 12, 1, 1, 3, 1);
1449 var actual = new DateTime(2022, 12, 1, 1, 3, 1);
1457 var expected = new DateTime(2022, 12, 1, 1, 3, 1);
1458 var actual = new DateTime(2011, 9, 13, 18, 22, 0);
1474 var expected = new DateTime(2022, 12, 1, 1, 3, 1);
1493 var actual = new DateTime(2022, 12, 1, 1, 3, 1);
Microsoft.Extensions.AI.Abstractions.Tests (2)
Microsoft.Extensions.Caching.Hybrid.Tests (2)
SerializerTests.cs (2)
191["x"] = (42, "Fred", new(2025, 03, 18)),
192["y"] = (43, "Barney", new(2025, 03, 22)),
Microsoft.Extensions.Compliance.Abstractions.Tests (1)
Microsoft.Extensions.Diagnostics.Testing.Tests (1)
Microsoft.Extensions.Options.Contextual.Tests (1)
Microsoft.Extensions.TimeProvider.Testing.Tests (1)
Microsoft.Gen.Logging.Generated.Tests (3)
LogPropertiesTests.cs (2)
319var now = new DateTime(2024, 1, 1, 0, 0, 0, DateTimeKind.Utc);
339var now = new DateTime(2024, 1, 1, 0, 0, 0, DateTimeKind.Utc);
Microsoft.Maui.Controls (2)
DatePicker\DatePicker.cs (2)
23 public static readonly BindableProperty MinimumDateProperty = BindableProperty.Create(nameof(MinimumDate), typeof(DateTime), typeof(DatePicker), new DateTime(1900, 1, 1),
27 public static readonly BindableProperty MaximumDateProperty = BindableProperty.Create(nameof(MaximumDate), typeof(DateTime), typeof(DatePicker), new DateTime(2100, 12, 31),
Microsoft.ML.Core.Tests (1)
Microsoft.ML.Data (2)
Microsoft.ML.Samples (7)
Microsoft.ML.Tests (9)
Scenarios\Api\TestApi.cs (8)
422Id = 0, TextStrat = "a", FloatStrat = 3, VectorStrat = new float[]{ 2, 3, 4, 5 }, DateTimeStrat = new DateTime(2002, 2, 23),
426Id = 1, TextStrat = "b", FloatStrat = 3, VectorStrat = new float[]{ 1, 2, 3, 4 }, DateTimeStrat = new DateTime(2020, 2, 23),
430Id = 2, TextStrat = "c", FloatStrat = 4, VectorStrat = new float[]{ 3, 4, 5, 6 }, DateTimeStrat = new DateTime(2018, 2, 23),
434Id = 3, TextStrat = "d", FloatStrat = 4, VectorStrat = new float[]{ 4, 5, 6, 7 }, DateTimeStrat = new DateTime(2016, 2, 23),
438Id = 4, TextStrat = "a", FloatStrat = -493.28f, VectorStrat = new float[]{ 2, 3, 4, 5 }, DateTimeStrat = new DateTime(2016, 2, 23),
442Id = 5, TextStrat = "b", FloatStrat = -493.28f, VectorStrat = new float[]{ 1, 2, 3, 4 }, DateTimeStrat = new DateTime(2018, 2, 23),
446Id = 6, TextStrat = "c", FloatStrat = 6, VectorStrat = new float[]{ 3, 4, 5, 6 }, DateTimeStrat = new DateTime(2020,2 , 23),
450Id = 7, TextStrat = "d", FloatStrat = 6, VectorStrat = new float[]{ 4, 5, 6, 7 }, DateTimeStrat = new DateTime(2002, 2, 23),
Microsoft.ML.TimeSeries.Tests (1)
Microsoft.Net.Http.Headers.Tests (2)
Microsoft.NET.Sdk.StaticWebAssets.Tests (14)
ComputeStaticWebAssetsTargetPathsTest.cs (3)
26var lastWrite = new DateTime(1990, 11, 15, 0, 0, 0, 0, DateTimeKind.Utc);
54var lastWrite = new DateTime(1990, 11, 15, 0, 0, 0, 0, DateTimeKind.Utc);
82var lastWrite = new DateTime(1990, 11, 15, 0, 0, 0, 0, DateTimeKind.Utc);
StaticWebAssets\DefineStaticWebAssetEndpointsTest.cs (7)
30var lastWrite = new DateTime(1990, 11, 15, 0, 0, 0, 0, DateTimeKind.Utc);
97var lastWrite = new DateTime(1990, 11, 15, 0, 0, 0, 0, DateTimeKind.Utc);
214var lastWrite = new DateTime(1990, 11, 15, 0, 0, 0, 0, DateTimeKind.Utc);
331var lastWrite = new DateTime(1990, 11, 15, 0, 0, 0, 0, DateTimeKind.Utc);
388var lastWrite = new DateTime(1990, 11, 15, 0, 0, 0, 0, DateTimeKind.Utc);
441var lastWrite = new DateTime(1990, 11, 15, 0, 0, 0, 0, DateTimeKind.Utc);
492var lastWrite = new DateTime(1990, 11, 15, 0, 0, 0, 0, DateTimeKind.Utc);
StaticWebAssets\GenerateStaticWebAssetsPropsFileTest.cs (3)
369["LastWriteTime"] = new DateTimeOffset(new DateTime(1990, 11, 15, 0, 0, 0, 0, DateTimeKind.Utc)).ToString(StaticWebAsset.DateTimeAssetFormat)
470["LastWriteTime"] = new DateTimeOffset(new DateTime(1990, 11, 15, 0, 0, 0, 0, DateTimeKind.Utc)).ToString(StaticWebAsset.DateTimeAssetFormat)
491["LastWriteTime"] = new DateTimeOffset(new DateTime(1990, 11, 15, 0, 0, 0, 0, DateTimeKind.Utc)).ToString(StaticWebAsset.DateTimeAssetFormat)
Microsoft.VisualBasic.Core (5)
MSBuildTaskHost (2)
PresentationBuildTasks (3)
PresentationCore (2)
PresentationFramework (13)
System\Windows\Controls\Calendar.cs (7)
728return new DateTime(DisplayDate.Year, 1, 1);
1364DateTime? selectedDate = new DateTime(this.DisplayDateInternal.Year, this.DisplayDateInternal.Month, 1);
1384DateTime selectedMonth = new DateTime(this.DisplayDate.Year, 12, 1);
1391DateTime? selectedYear = new DateTime(DateTimeHelper.EndOfDecade(this.DisplayDate), 1, 1);
1427DateTime? selectedDate = new DateTime(this.DisplayDateInternal.Year, this.DisplayDateInternal.Month, 1);
1434DateTime selectedMonth = new DateTime(this.DisplayDate.Year, 1, 1);
1441DateTime? selectedYear = new DateTime(DateTimeHelper.DecadeOfDate(this.DisplayDate), 1, 1);
System\Windows\Controls\DatePicker.cs (2)
1017DateTime newD = new DateTime(year, month, 1, 0, 0, 0);
1033DateTime newD = new DateTime(year, month, day, 0, 0, 0);
Roslyn.Test.PdbUtilities (1)
ScenarioTests.Common.Tests (2)
Shared.Tests (2)
SignalR.Client.FunctionalTestApp (1)
Stress.TelemetryService (1)
System.Data.Common (3)
System.Data.Odbc (2)
System.Diagnostics.Process (1)
System.Formats.Asn1 (1)
System.Formats.Nrbf (1)
System.IO.Compression (2)
System\IO\Compression\ZipHelper.cs (2)
20private static readonly DateTime s_invalidDateIndicator = new DateTime(ValidZipDate_YearMin, 1, 1, 0, 0, 0);
62return new DateTime(year, month, day, hour, minute, second, 0);
System.IO.Compression.ZipFile (1)
System.Net.Requests (1)
System.Private.CoreLib (143)
src\libraries\System.Private.CoreLib\src\System\DateOnly.cs (2)
58public DateOnly(int year, int month, int day) => _dayNumber = DayNumberFromDateTime(new DateTime(year, month, day));
67public DateOnly(int year, int month, int day, Calendar calendar) => _dayNumber = DayNumberFromDateTime(new DateTime(year, month, day, calendar));
src\libraries\System.Private.CoreLib\src\System\DateTime.cs (31)
115public static readonly DateTime MaxValue = new DateTime(MaxTicks, DateTimeKind.Unspecified);
116public static readonly DateTime UnixEpoch = new DateTime(UnixEpochTicks, DateTimeKind.Utc);
155internal static DateTime CreateUnchecked(long ticks) => new DateTime((ulong)ticks);
308return ValidateLeapSecond(new DateTime(year, month, day, hour, minute, 59, millisecond, calendar, kind));
332return ValidateLeapSecond(new DateTime(ticks + TimeToTicks(hour, minute, 59)));
371return ValidateLeapSecond(new DateTime(year, month, day, hour, minute, 59, calendar));
415/// the <see cref="DateTime(int, int, int, int, int, int, int, int, Calendar)"/> constructor.
477/// the <see cref="DateTime(int, int, int, int, int, int, int, int, Calendar, DateTimeKind)"/> constructor.
557return ValidateLeapSecond(new DateTime(year, month, day, hour, minute, 59, millisecond, calendar));
606/// the <see cref="DateTime(int, int, int, int, int, int, int, int, Calendar)"/> constructor.
671/// the <see cref="DateTime(int, int, int, int, int, int, int, int, Calendar, DateTimeKind)"/> constructor.
976return new DateTime(n * (ulong)TimeSpan.TicksPerDay + date.UTicks % TimeSpan.TicksPerDay | date.InternalKind);
996return new DateTime(ticks | InternalKind);
1008result = new DateTime(ticks | InternalKind);
1043return new DateTime(n * (ulong)TimeSpan.TicksPerDay + date.UTicks % TimeSpan.TicksPerDay | date.InternalKind);
1232DateTime utcDt = new DateTime(ticks, DateTimeKind.Utc);
1246return new DateTime(ticks, DateTimeKind.Local, isAmbiguousLocalDst);
1252return new DateTime((ulong)dateData);
1279return new DateTime(universalTicks | KindUtc);
1286return new DateTime(DoubleDateToTicks(d), DateTimeKind.Unspecified);
1310return new DateTime(value.UTicks | ((ulong)(uint)kind << KindShift));
1346public DateTime Date => new((UTicks / TimeSpan.TicksPerDay * TimeSpan.TicksPerDay) | InternalKind);
1513return new DateTime((ulong)localTicks | (isAmbiguousLocalDst ? KindLocalAmbiguousDst : KindLocal));
1650return new DateTime(ticks | InternalKind);
1717return new DateTime((ulong)tick | KindLocal);
1719return new DateTime((ulong)tick | KindLocalAmbiguousDst);
1721return new DateTime(tick < 0 ? KindLocal : MaxTicks | KindLocal);
1850return new DateTime(ticks | d.InternalKind);
1857return new DateTime(ticks | d.InternalKind);
2005if (!IsValidTimeWithLeapSeconds(new DateTime(ticks)))
2014result = new DateTime(ticks);
src\libraries\System.Private.CoreLib\src\System\DateTimeOffset.cs (3)
81public DateTimeOffset(long ticks, TimeSpan offset) : this(ValidateOffset(offset), ValidateDate(new DateTime(ticks), offset))
135: this(new DateTime(date, time), offset)
147_dateTime = ValidateDate(new DateTime(year, month, day, hour, minute, second), offset);
src\libraries\System.Private.CoreLib\src\System\Globalization\HebrewCalendar.cs (10)
273private static readonly DateTime s_calendarMinValue = new DateTime(1583, 1, 1);
277private static readonly DateTime s_calendarMaxValue = new DateTime((new DateTime(2239, 9, 29, 23, 59, 59, 999)).Ticks + 9999);
445DateTime time = new DateTime(ticks);
569return new DateTime(ToDateTime(y, i, d, 0, 0, 0, 0).Ticks + (time.Ticks % TimeSpan.TicksPerDay));
602return new DateTime(ticks);
642beginOfYearDate = new DateTime(1582, 9, 27);
822return new DateTime(gregorianYear, 1, 1, hour, minute, second, millisecond);
827DateTime gregorianNewYear = new DateTime(gregorianYear, 1, 1);
828return new DateTime(gregorianNewYear.Ticks + days * TimeSpan.TicksPerDay + TimeToTicks(hour, minute, second, millisecond));
src\libraries\System.Private.CoreLib\src\System\Globalization\UmAlQuraCalendar.cs (6)
25GregorianDate = new DateTime(GYear, GMonth, GDay);
243private static readonly DateTime s_minDate = new DateTime(1900, 4, 30);
244private static readonly DateTime s_maxDate = new DateTime((new DateTime(2077, 11, 16, 23, 59, 59, 999)).Ticks + 9999);
447DateTime dt = new DateTime(GetAbsoluteDateUmAlQura(y, m, d) * TimeSpan.TicksPerDay + time.Ticks % TimeSpan.TicksPerDay);
594return new DateTime(lDate * TimeSpan.TicksPerDay + TimeToTicks(hour, minute, second, millisecond));
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.Cache.cs (17)
180dateTimeNowCache._nextUtcNowTransitionTicks = utcNow.Year >= MaxYear ? DateTime.MaxTicks : new DateTime(utcNow.Year + 1, 1, 1).Ticks; // check again next year
343=> (ulong)ticks <= DateTime.MaxTicks ? new DateTime(ticks, kind) : (ticks < 0 ? DateTime.MinValue : DateTime.MaxValue);
545new DateTime(year, 1, 1, 0, 0, 0, DateTimeKind.Unspecified) :
556year >= MaxYear ? DateTime.MaxValue : new DateTime(year + 1, 1, 1, 0, 0, 0, DateTimeKind.Unspecified) :
582value = new DateTime(year, transitionTime.Month, day) + timeOfDay;
591value = new DateTime(year, transitionTime.Month, 1) + timeOfDay;
612value = new DateTime(year, transitionTime.Month, daysInMonth) + timeOfDay;
663DateTime startOfYear = new DateTime(year, 1, 1);
757DateTime transitionStart = new DateTime(year > 1 ? year - 1 : 1, 1, 1);
779DateTime endOfCurrentYear = year < MaxYear ? new DateTime(year + 1, 1, 1).AddTicks(-1) : DateTime.MaxValue;
844DateTime nextBeginningOfYearUtc = GetUtcDateTimeFromLocalTicks(new DateTime(year + 1, 1, 1).Ticks, nextRule, includeDaylightDelta: true);
886DateTime endOfNextYear = year + 1 < MaxYear ? new DateTime(year + 2, 1, 1).AddTicks(-1) : DateTime.MaxValue;
913long startOfCurrentYearUtcTicks = new DateTime(year, 1, 1).Ticks - GetTransitionUtcOffsetTicks(rule, includeDaylightDelta: startWithDaylightOn || localStart > localEnd);
915DateTime currentYearStart = new DateTime(year, 1, 1);
1012DateTime previousYearStart = new DateTime(year > 1 ? year - 1 : 1, 1, 1); // real Utc year start
1039DateTime endOfCurrentYear = year < MaxYear ? new DateTime(year + 1, 1, 1).AddTicks(-1) : DateTime.MaxValue;
1223DateTime endOfCurrentYear = year < MaxYear ? new DateTime(year + 1, 1, 1).AddTicks(-1) : DateTime.MaxValue;
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.Unix.cs (10)
139private static DateTime GetTimeOnlyInMillisecondsPrecision(DateTime input) => new DateTime((input.TimeOfDay.Ticks / TimeSpan.TicksPerMillisecond) * TimeSpan.TicksPerMillisecond);
172new DateTime(rule.DateStart.Ticks + _baseUtcOffset.Ticks, DateTimeKind.Unspecified) :
177new DateTime(rule.DateEnd.Ticks + _baseUtcOffset.Ticks + rule.DaylightDelta.Ticks, DateTimeKind.Unspecified) :
200DateTime endForFirstRule = new DateTime(start.Year + 1, 1, 1).AddMilliseconds(-1); // At the end of the first year
209DateTime middleYearStart = new DateTime(start.Year + 1, 1, 1);
210DateTime middleYearEnd = new DateTime(end.Year, 1, 1).AddMilliseconds(-1);
217DateTime endYearStart = new DateTime(end.Year, 1, 1); // At the beginning of the last year
815timeOfDay = new DateTime(1, 1, 2, 0, 0, 0);
819timeOfDay = new DateTime(1, 1, 1, 0, 0, 0);
827timeOfDay = new DateTime(1, 1, 1, 2, 0, 0);
System.Private.DataContractSerialization (3)
System.Private.Windows.Core (2)
System.Private.Xml (28)
System\Xml\BinaryXml\SqlUtils.cs (8)
523return new DateTime(yr, mnth, day, hr, min, sec, ms, DateTimeKind.Utc);
549DateTime d = new DateTime(yr, mnth, day, 0, 0, 0, DateTimeKind.Utc);
574return new DateTime(1, 1, 1, hr, min, sec, ms, DateTimeKind.Utc);
585DateTime SQLBaseDate = new DateTime(1900, 1, 1);
614DateTime dt = new DateTime(dateTicks);
623DateTime dt = new DateTime(dateTicks + timeTicks);
775return (int)(dt.Ticks - new DateTime(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, dt.Second).Ticks);
780return (int)(dt.Ticks - new DateTime(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, dt.Second).Ticks);
System\Xml\Schema\XsdDateTime.cs (15)
145_dt = new DateTime(parser.year, parser.month, parser.day, parser.hour, parser.minute, parser.second);
355XsdDateTimeKind.Zulu => new DateTime(_dt.Ticks, DateTimeKind.Utc),
358XsdDateTimeKind.LocalEastOfZulu => new DateTime(_dt.Subtract(new TimeSpan(ZoneHour, ZoneMinute, 0)).Ticks, DateTimeKind.Utc),
359XsdDateTimeKind.LocalWestOfZulu => new DateTime(_dt.Add(new TimeSpan(ZoneHour, ZoneMinute, 0)).Ticks, DateTimeKind.Utc),
390result = new DateTime(DateTime.Now.Year, xdt.Month, xdt.Day);
395TimeSpan addDiff = new DateTime(currentDateTime.Year, currentDateTime.Month, currentDateTime.Day) - new DateTime(xdt.Year, xdt.Month, xdt.Day);
408result = new DateTime(result.Ticks, DateTimeKind.Utc);
419return new DateTime(ticks, DateTimeKind.Local);
421result = new DateTime(ticks, DateTimeKind.Utc).ToLocalTime();
432return new DateTime(ticks, DateTimeKind.Local);
434result = new DateTime(ticks, DateTimeKind.Utc).ToLocalTime();
450dt = new DateTime(DateTime.Now.Year, xdt.Month, xdt.Day);
455TimeSpan addDiff = new DateTime(currentDateTime.Year, currentDateTime.Month, currentDateTime.Day) - new DateTime(xdt.Year, xdt.Month, xdt.Day);
System.Reflection.Metadata (2)
System.Resources.Extensions (1)
System.Runtime.Caching (1)
System.Security.Cryptography (1)
System.ServiceModel.Primitives (4)
System.Text.Json (1)
System.Transactions.Local (1)
System.Windows.Forms (3)
System.Windows.Forms.Primitives (1)
System.Windows.Forms.Primitives.Tests (24)
System.Windows.Forms.Tests (497)
System.Windows.Forms.UI.IntegrationTests (7)
System.Xaml.Tests (19)
System\Windows\Markup\DateTimeValueSerializerTests.cs (10)
14yield return new object?[] { new DateTime(), true };
29yield return new object[] { new DateTime(2018, 12, 9, 0, 0, 0, 0, DateTimeKind.Local), "yyyy-MM-dd'T'HH':'mmK" };
30yield return new object[] { new DateTime(2018, 12, 9, 0, 0, 0, 0, DateTimeKind.Utc), "yyyy-MM-dd'T'HH':'mmK" };
31yield return new object[] { new DateTime(2018, 12, 9, 0, 0, 0, 0, DateTimeKind.Unspecified), "yyyy-MM-ddK" };
32yield return new object[] { new DateTime(2018, 12, 9, 1, 2, 0, 0), "yyyy-MM-dd'T'HH':'mmK" };
33yield return new object[] { new DateTime(2018, 12, 9, 1, 2, 3, 0), "yyyy-MM-dd'T'HH':'mm':'ssK" };
34yield return new object[] { new DateTime(2018, 12, 9, 1, 2, 3, 4), "yyyy-MM-dd'T'HH':'mm':'ss'.'FFFFFFFK" };
65foreach (DateTime date in new DateTime[] { new DateTime(2018, 12, 9), new DateTime(2018, 12, 9, 1, 2, 0, 0), new DateTime(2018, 12, 9, 1, 2, 3, 0) })
System\Xaml\Replacements\DateTimeConverter2Tests.cs (9)
31foreach (DateTime date in new DateTime[] { new DateTime(2018, 12, 9), new DateTime(2018, 12, 9, 1, 2, 0, 0), new DateTime(2018, 12, 9, 1, 2, 3, 0) })
70yield return new object[] { new DateTime(2018, 12, 9, 0, 0, 0, 0, DateTimeKind.Local), "yyyy-MM-dd'T'HH':'mmK" };
71yield return new object[] { new DateTime(2018, 12, 9, 0, 0, 0, 0, DateTimeKind.Utc), "yyyy-MM-dd'T'HH':'mmK" };
72yield return new object[] { new DateTime(2018, 12, 9, 0, 0, 0, 0, DateTimeKind.Unspecified), "yyyy-MM-ddK" };
73yield return new object[] { new DateTime(2018, 12, 9, 1, 2, 0, 0), "yyyy-MM-dd'T'HH':'mmK" };
74yield return new object[] { new DateTime(2018, 12, 9, 1, 2, 3, 0), "yyyy-MM-dd'T'HH':'mm':'ssK" };
75yield return new object[] { new DateTime(2018, 12, 9, 1, 2, 3, 4), "yyyy-MM-dd'T'HH':'mm':'ss'.'FFFFFFFK" };
UIAutomationTypes (1)
UnsupportedTypes (1)
WindowsBase.Tests (4)
System\Security\RightsManagement\ContentGrantTests.cs (4)
52yield return new object[] { new ContentUser("name", AuthenticationType.Windows), ContentRight.Export, new DateTime(2023, 01, 01), new DateTime(2023, 01, 02) };
86Assert.Throws<ArgumentOutOfRangeException>("validFrom", () => new ContentGrant(user, ContentRight.View, new DateTime(2023, 01, 01), new DateTime(2023, 01, 01).AddTicks(-1)));
WinFormsControlsTest (6)
8075 references to DateTime
aspire (14)
Aspire.Azure.Npgsql.EntityFrameworkCore.PostgreSQL.Tests (1)
Aspire.Azure.Npgsql.Tests (1)
Aspire.Cli.Tests (6)
Aspire.Dashboard (125)
artifacts\obj\Aspire.Dashboard\Debug\net8.0\DashboardServiceGrpc.cs (7)
183public virtual global::Aspire.DashboardService.Proto.V1.ApplicationInformationResponse GetApplicationInformation(global::Aspire.DashboardService.Proto.V1.ApplicationInformationRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
193public virtual grpc::AsyncUnaryCall<global::Aspire.DashboardService.Proto.V1.ApplicationInformationResponse> GetApplicationInformationAsync(global::Aspire.DashboardService.Proto.V1.ApplicationInformationRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
203public virtual grpc::AsyncServerStreamingCall<global::Aspire.DashboardService.Proto.V1.WatchResourcesUpdate> WatchResources(global::Aspire.DashboardService.Proto.V1.WatchResourcesRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
213public virtual grpc::AsyncServerStreamingCall<global::Aspire.DashboardService.Proto.V1.WatchResourceConsoleLogsUpdate> WatchResourceConsoleLogs(global::Aspire.DashboardService.Proto.V1.WatchResourceConsoleLogsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
223public virtual global::Aspire.DashboardService.Proto.V1.ResourceCommandResponse ExecuteResourceCommand(global::Aspire.DashboardService.Proto.V1.ResourceCommandRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
233public virtual grpc::AsyncUnaryCall<global::Aspire.DashboardService.Proto.V1.ResourceCommandResponse> ExecuteResourceCommandAsync(global::Aspire.DashboardService.Proto.V1.ResourceCommandRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
243public virtual grpc::AsyncDuplexStreamingCall<global::Aspire.DashboardService.Proto.V1.WatchInteractionsRequestUpdate, global::Aspire.DashboardService.Proto.V1.WatchInteractionsResponseUpdate> WatchInteractions(grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
Model\TraceHelpers.cs (6)
44static void Visit(Dictionary<OtlpSpan, List<OtlpSpan>> spanLookup, OtlpSpan span, Func<OtlpSpan, TState, TState> spanAction, TState state, Func<OtlpSpan, DateTime> orderByFunc)
58private readonly record struct OrderedResourcesState(DateTime? CurrentMinDate);
71var currentMinDate = (state.CurrentMinDate == null || state.CurrentMinDate < span.StartTime)
89private static void ProcessSpanResource(OtlpSpan span, OtlpResource resource, Dictionary<OtlpResource, OrderedResource> resourceFirstTimes, DateTime currentMinDate)
168public sealed class OrderedResource(OtlpResource resource, int index, DateTime firstDateTime, int totalSpans, int erroredSpans)
172public DateTime FirstDateTime { get; set; } = firstDateTime;
Aspire.Dashboard.Components.Tests (22)
Controls\GenAIVisualizerDialogTests.cs (3)
24private static readonly DateTime s_testTime = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
32var trace = new OtlpTrace(new byte[] { 1, 2, 3 }, DateTime.MinValue);
95var trace = new OtlpTrace(new byte[] { 1, 2, 3 }, DateTime.MinValue);
tests\Shared\Telemetry\TelemetryTestHelpers.cs (12)
68public static Metric CreateHistogramMetric(string metricName, DateTime startTime)
93public static Metric CreateSumMetric(string metricName, DateTime startTime, IEnumerable<KeyValuePair<string, string>>? attributes = null, IEnumerable<Exemplar>? exemplars = null, int? value = null)
112private static NumberDataPoint CreateNumberPoint(DateTime startTime, int value, IEnumerable<KeyValuePair<string, string>>? attributes = null, IEnumerable<Exemplar>? exemplars = null)
156public static Span CreateSpan(string traceId, string spanId, DateTime startTime, DateTime endTime, string? parentSpanId = null, List<Span.Types.Event>? events = null, List<Span.Types.Link>? links = null, IEnumerable<KeyValuePair<string, string>>? attributes = null, Span.Types.SpanKind? kind = null, Status? status = null)
188public static LogRecord CreateLogRecord(DateTime? time = null, DateTime? observedTime = null, string? message = null, SeverityNumber? severity = null, IEnumerable<KeyValuePair<string, string>>? attributes = null,
278public static ulong DateTimeToUnixNanoseconds(DateTime dateTime)
280var unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
306public static OtlpSpan CreateOtlpSpan(OtlpResource resource, OtlpTrace trace, OtlpScope scope, string spanId, string? parentSpanId, DateTime startDate,
308OtlpResource? uninstrumentedPeer = null, DateTime? endDate = null, string? spanName = null)
314EndTime = endDate ?? DateTime.MaxValue,
Aspire.Dashboard.Tests (86)
Model\SpanWaterfallViewModelTests.cs (8)
26var trace = new OtlpTrace(new byte[] { 1, 2, 3 }, DateTime.MinValue);
56var date = new DateTime(2001, 1, 1, 1, 1, 2, DateTimeKind.Utc);
57var trace = new OtlpTrace(new byte[] { 1, 2, 3 }, DateTime.MinValue);
86var trace = new OtlpTrace(new byte[] { 1, 2, 3 }, DateTime.MinValue);
119var trace = new OtlpTrace(new byte[] { 1, 2, 3 }, DateTime.MinValue);
180var trace = new OtlpTrace(new byte[] { 1, 2, 3 }, DateTime.MinValue);
230var trace = new OtlpTrace(new byte[] { 1, 2, 3 }, DateTime.MinValue);
252var trace = new OtlpTrace(new byte[] { 1, 2, 3 }, DateTime.MinValue);
Model\TraceHelpersTests.cs (5)
20var trace = new OtlpTrace(new byte[] { 1, 2, 3 }, DateTime.MinValue);
42var trace = new OtlpTrace(new byte[] { 1, 2, 3 }, DateTime.MinValue);
69var trace = new OtlpTrace(new byte[] { 1, 2, 3 }, DateTime.MinValue);
97var trace = new OtlpTrace(new byte[] { 1, 2, 3 }, DateTime.MinValue);
131var trace = new OtlpTrace(new byte[] { 1, 2, 3 }, DateTime.MinValue);
TelemetryRepositoryTests\MetricsTests.cs (16)
20private static readonly DateTime s_testTime = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
156StartTime = DateTime.MinValue,
157EndTime = DateTime.MaxValue
272StartTime = DateTime.MinValue,
273EndTime = DateTime.MaxValue
316var start = s_testTime.AddMinutes(1);
318var end = OtlpHelpers.UnixNanoSecondsToDateTime(nanoSeconds);
409private static Exemplar CreateExemplar(DateTime startTime, double value, IEnumerable<KeyValuePair<string, string>>? attributes = null)
477StartTime = DateTime.MinValue,
478EndTime = DateTime.MaxValue
1118StartTime = DateTime.MinValue,
1119EndTime = DateTime.MaxValue
1175StartTime = DateTime.MinValue,
1176EndTime = DateTime.MaxValue
1187StartTime = DateTime.MinValue,
1188EndTime = DateTime.MaxValue
TelemetryRepositoryTests\OtlpSpanTests.cs (6)
14private static readonly DateTime s_testTime = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
22var trace = new OtlpTrace(new byte[] { 1, 2, 3 }, DateTime.MinValue);
73var trace = new OtlpTrace(new byte[] { 1, 2, 3 }, DateTime.MinValue);
92var trace = new OtlpTrace(new byte[] { 1, 2, 3 }, DateTime.MinValue);
112var trace = new OtlpTrace(new byte[] { 1, 2, 3 }, DateTime.MinValue);
175var trace = new OtlpTrace(new byte[] { 1, 2, 3 }, DateTime.MinValue);
TelemetryRepositoryTests\TelemetryRepositoryTests.cs (10)
70CreateLogRecord(time: DateTime.Now, message: "1", severity: SeverityNumber.Error),
93CreateSumMetric(metricName: "test", startTime: DateTime.Now.AddMinutes(1)),
94CreateSumMetric(metricName: "test", startTime: DateTime.Now.AddMinutes(2)),
95CreateSumMetric(metricName: "test2", startTime: DateTime.Now.AddMinutes(1)),
103CreateSumMetric(metricName: "test", startTime: DateTime.Now.AddMinutes(1)),
104CreateHistogramMetric(metricName: "test2", startTime: DateTime.Now.AddMinutes(1))
127CreateSpan(traceId: "1", spanId: "1-1", startTime: DateTime.Now.AddMinutes(1), endTime: DateTime.Now.AddMinutes(10)),
128CreateSpan(traceId: "1", spanId: "1-2", startTime: DateTime.Now.AddMinutes(5), endTime: DateTime.Now.AddMinutes(10), parentSpanId: "1-1")
tests\Shared\Telemetry\TelemetryTestHelpers.cs (12)
68public static Metric CreateHistogramMetric(string metricName, DateTime startTime)
93public static Metric CreateSumMetric(string metricName, DateTime startTime, IEnumerable<KeyValuePair<string, string>>? attributes = null, IEnumerable<Exemplar>? exemplars = null, int? value = null)
112private static NumberDataPoint CreateNumberPoint(DateTime startTime, int value, IEnumerable<KeyValuePair<string, string>>? attributes = null, IEnumerable<Exemplar>? exemplars = null)
156public static Span CreateSpan(string traceId, string spanId, DateTime startTime, DateTime endTime, string? parentSpanId = null, List<Span.Types.Event>? events = null, List<Span.Types.Link>? links = null, IEnumerable<KeyValuePair<string, string>>? attributes = null, Span.Types.SpanKind? kind = null, Status? status = null)
188public static LogRecord CreateLogRecord(DateTime? time = null, DateTime? observedTime = null, string? message = null, SeverityNumber? severity = null, IEnumerable<KeyValuePair<string, string>>? attributes = null,
278public static ulong DateTimeToUnixNanoseconds(DateTime dateTime)
280var unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
306public static OtlpSpan CreateOtlpSpan(OtlpResource resource, OtlpTrace trace, OtlpScope scope, string spanId, string? parentSpanId, DateTime startDate,
308OtlpResource? uninstrumentedPeer = null, DateTime? endDate = null, string? spanName = null)
314EndTime = endDate ?? DateTime.MaxValue,
Aspire.EndToEnd.Tests (1)
Aspire.Hosting (44)
Aspire.Hosting.Azure (2)
Aspire.Hosting.DevTunnels (4)
Aspire.Hosting.GitHub.Models (1)
Aspire.Hosting.Kubernetes (3)
Aspire.Hosting.OpenAI (2)
Aspire.Hosting.Tests (28)
Dashboard\DashboardLifecycleHookTests.cs (3)
27public async Task WatchDashboardLogs_WrittenToHostLoggerFactory(DateTime? timestamp, string logMessage, string expectedMessage, string expectedCategory, LogLevel expectedLevel)
525var timestamp = new DateTime(2001, 12, 29, 23, 59, 59, DateTimeKind.Utc);
537DateTime.UtcNow,
Aspire.Playground.Tests (1)
Aspire.StackExchange.Redis (3)
Aspire.Templates.Tests (2)
Aspire.TestUtilities (1)
AspireJavaScript.MinimalApi (1)
AspireWithNode.AspNetCoreApi (1)
AuthSamples.FunctionalTests (4)
CustomPolicyProviderTests.cs (4)
51var signIn = await SignIn(Client, "Dude", DateTime.Now.Subtract(TimeSpan.FromDays(365 * 20)).ToString(DateTimeFormatInfo.InvariantInfo.ShortDatePattern, CultureInfo.InvariantCulture));
67var signIn = await SignIn(Client, "Dude", DateTime.Now.Subtract(TimeSpan.FromDays(365 * 5)).ToString(DateTimeFormatInfo.InvariantInfo.ShortDatePattern, CultureInfo.InvariantCulture));
82var signIn = await SignIn(Client, "Dude", DateTime.Now.Subtract(TimeSpan.FromDays(365 * 55)).ToString(DateTimeFormatInfo.InvariantInfo.ShortDatePattern, CultureInfo.InvariantCulture));
98var signIn = await SignIn(Client, "Dude", DateTime.Now.Subtract(TimeSpan.FromDays(365 * 20)).ToString(DateTimeFormatInfo.InvariantInfo.ShortDatePattern, CultureInfo.InvariantCulture));
AzureContainerApps.ApiService (1)
BasicWebSite (6)
BinaryFormatTests (10)
BlazorServerApp (3)
BlazorUnitedApp (1)
ClaimsTransformation (1)
Client.ExpectedExceptions.IntegrationTests (18)
containerize.UnitTests (6)
ParserTests.cs (6)
15DirectoryInfo publishDir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), DateTime.Now.ToString("yyyyMMddHHmmssfff"), nameof(CanParseLabels)));
58DirectoryInfo publishDir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), DateTime.Now.ToString("yyyyMMddHHmmssfff"), nameof(CanParseLabels)));
94DirectoryInfo publishDir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), DateTime.Now.ToString("yyyyMMddHHmmssfff"), nameof(CanParseLabels)));
126DirectoryInfo publishDir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), DateTime.Now.ToString("yyyyMMddHHmmssfff"), nameof(CanParseEnvironmentVariables)));
170DirectoryInfo publishDir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), DateTime.Now.ToString("yyyyMMddHHmmssfff"), nameof(CanParsePorts)));
215DirectoryInfo publishDir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), DateTime.Now.ToString("yyyyMMddHHmmssfff"), nameof(CanParsePorts)));
Contract.Message.IntegrationTests (9)
Contract.XmlSerializer.IntegrationTests (12)
CustomPolicyProvider (4)
CustomResources.AppHost (6)
Deployers.ApiService (1)
dotnet (21)
dotnet.Tests (9)
dotnet-dev-certs (2)
dotnet-new.IntegrationTests (6)
dotnet-svcutil.xmlserializer.IntegrationTests (12)
dotnet-svcutil-lib (558)
FrameworkFork\Microsoft.Xml\Xml\BinaryXml\SqlUtils.cs (21)
828public static DateTime XsdDateTimeToDateTime(long val)
844public static DateTime XsdDateToDateTime(long val)
848DateTime d = new DateTime(yr, mnth, day, 0, 0, 0, DateTimeKind.Utc);
863public static DateTime XsdTimeToDateTime(long val)
872DateTime dateTime = SqlDateTimeToDateTime(dateticks, timeticks);
876public static DateTime SqlDateTimeToDateTime(int dateticks, uint timeticks)
878DateTime SQLBaseDate = new DateTime(1900, 1, 1);
895DateTime dateTime = SqlSmallDateTimeToDateTime(dateticks, timeticks);
898public static DateTime SqlSmallDateTimeToDateTime(short dateticks, ushort timeticks)
904public static DateTime XsdKatmaiDateToDateTime(byte[] data, int offset)
908DateTime dt = new DateTime(dateTicks);
912public static DateTime XsdKatmaiDateTimeToDateTime(byte[] data, int offset)
917DateTime dt = new DateTime(dateTicks + timeTicks);
921public static DateTime XsdKatmaiTimeToDateTime(byte[] data, int offset)
927public static DateTime XsdKatmaiDateOffsetToDateTime(byte[] data, int offset)
933public static DateTime XsdKatmaiDateTimeOffsetToDateTime(byte[] data, int offset)
939public static DateTime XsdKatmaiTimeOffsetToDateTime(byte[] data, int offset)
990DateTime dt = XsdKatmaiDateToDateTime(data, offset);
998DateTime dt = XsdKatmaiDateTimeToDateTime(data, offset);
1008DateTime dt = XsdKatmaiTimeToDateTime(data, offset);
1086private static int GetFractions(DateTime dt)
FrameworkFork\Microsoft.Xml\Xml\schema\XmlValueConverter.cs (120)
168public abstract bool ToBoolean(DateTime value);
179public abstract int ToInt32(DateTime value);
190public abstract long ToInt64(DateTime value);
201public abstract decimal ToDecimal(DateTime value);
212public abstract double ToDouble(DateTime value);
223public abstract float ToSingle(DateTime value);
228public abstract DateTime ToDateTime(bool value);
229public abstract DateTime ToDateTime(int value);
230public abstract DateTime ToDateTime(long value);
231public abstract DateTime ToDateTime(decimal value);
232public abstract DateTime ToDateTime(float value);
233public abstract DateTime ToDateTime(double value);
234public abstract DateTime ToDateTime(DateTime value);
235public abstract DateTime ToDateTime(DateTimeOffset value);
236public abstract DateTime ToDateTime(string value);
237public abstract DateTime ToDateTime(object value);
245public abstract DateTimeOffset ToDateTimeOffset(DateTime value);
256public abstract string ToString(DateTime value);
269public abstract object ChangeType(DateTime value, Type destinationType);
365protected static readonly Type DateTimeType = typeof(DateTime);
375public override bool ToBoolean(DateTime value) { return (bool)ChangeType((object)value, BooleanType, null); }
385public override DateTime ToDateTime(bool value) { return (DateTime)ChangeType((object)value, DateTimeType, null); }
386public override DateTime ToDateTime(DateTime value) { return (DateTime)ChangeType((object)value, DateTimeType, null); }
387public override DateTime ToDateTime(DateTimeOffset value) { return (DateTime)ChangeType((object)value, DateTimeType, null); }
388public override DateTime ToDateTime(decimal value) { return (DateTime)ChangeType((object)value, DateTimeType, null); }
389public override DateTime ToDateTime(double value) { return (DateTime)ChangeType((object)value, DateTimeType, null); }
390public override DateTime ToDateTime(int value) { return (DateTime)ChangeType((object)value, DateTimeType, null); }
391public override DateTime ToDateTime(long value) { return (DateTime)ChangeType((object)value, DateTimeType, null); }
392public override DateTime ToDateTime(float value) { return (DateTime)ChangeType((object)value, DateTimeType, null); }
393public override DateTime ToDateTime(string value) { return (DateTime)ChangeType((object)value, DateTimeType, null); }
394public override DateTime ToDateTime(object value) { return (DateTime)ChangeType((object)value, DateTimeType, null); }
397public override DateTimeOffset ToDateTimeOffset(DateTime value) { return (DateTimeOffset)ChangeType((object)value, DateTimeOffsetType, null); }
408public override decimal ToDecimal(DateTime value) { return (decimal)ChangeType((object)value, DecimalType, null); }
419public override double ToDouble(DateTime value) { return (double)ChangeType((object)value, DoubleType, null); }
430public override int ToInt32(DateTime value) { return (int)ChangeType((object)value, Int32Type, null); }
441public override long ToInt64(DateTime value) { return (long)ChangeType((object)value, Int64Type, null); }
452public override float ToSingle(DateTime value) { return (float)ChangeType((object)value, SingleType, null); }
463public override string ToString(DateTime value) { return (string)ChangeType((object)value, StringType, null); }
476public override object ChangeType(DateTime value, Type destinationType) { return (object)ChangeType((object)value, destinationType, null); }
613protected static DateTime StringToDate(string value)
615return (DateTime)(new XsdDateTime(value, XsdDateTimeFlags.Date));
618protected static DateTime StringToDateTime(string value)
620return (DateTime)(new XsdDateTime(value, XsdDateTimeFlags.DateTime));
634protected static DateTime StringToGDay(string value)
636return (DateTime)(new XsdDateTime(value, XsdDateTimeFlags.GDay));
639protected static DateTime StringToGMonth(string value)
641return (DateTime)(new XsdDateTime(value, XsdDateTimeFlags.GMonth));
644protected static DateTime StringToGMonthDay(string value)
646return (DateTime)(new XsdDateTime(value, XsdDateTimeFlags.GMonthDay));
649protected static DateTime StringToGYear(string value)
651return (DateTime)(new XsdDateTime(value, XsdDateTimeFlags.GYear));
654protected static DateTime StringToGYearMonth(string value)
656return (DateTime)(new XsdDateTime(value, XsdDateTimeFlags.GYearMonth));
735protected static DateTime StringToTime(string value)
737return (DateTime)(new XsdDateTime(value, XsdDateTimeFlags.Time));
766protected static string DateToString(DateTime value)
771protected static string DateTimeToString(DateTime value)
786protected static string GDayToString(DateTime value)
791protected static string GMonthToString(DateTime value)
796protected static string GMonthDayToString(DateTime value)
801protected static string GYearToString(DateTime value)
806protected static string GYearMonthToString(DateTime value)
860protected static string TimeToString(DateTime value)
880internal static DateTime DateTimeOffsetToDateTime(DateTimeOffset value)
957protected static DateTime UntypedAtomicToDateTime(string value)
959return (DateTime)(new XsdDateTime(value, XsdDateTimeFlags.AllXsd));
1559public override DateTime ToDateTime(DateTime value)
1561return ((DateTime)value);
1564public override DateTime ToDateTime(DateTimeOffset value)
1569public override DateTime ToDateTime(string value)
1585public override DateTime ToDateTime(object value)
1591if (sourceType == DateTimeType) return ((DateTime)value);
1596return (DateTime)ChangeListType(value, DateTimeType, null);
1603public override DateTimeOffset ToDateTimeOffset(DateTime value)
1636if (sourceType == DateTimeType) return ToDateTimeOffset((DateTime)value);
1683public override string ToString(DateTime value)
1687case XmlTypeCode.Date: return DateToString((DateTime)value);
1688case XmlTypeCode.Time: return TimeToString((DateTime)value);
1689case XmlTypeCode.GDay: return GDayToString((DateTime)value);
1690case XmlTypeCode.GMonth: return GMonthToString((DateTime)value);
1691case XmlTypeCode.GMonthDay: return GMonthDayToString((DateTime)value);
1692case XmlTypeCode.GYear: return GYearToString((DateTime)value);
1693case XmlTypeCode.GYearMonth: return GYearMonthToString((DateTime)value);
1695return DateTimeToString((DateTime)value);
1725if (sourceType == DateTimeType) return this.ToString((DateTime)value);
1738public override object ChangeType(DateTime value, Type destinationType)
1743if (destinationType == DateTimeType) return ((DateTime)value);
1744if (destinationType == DateTimeOffsetType) return this.ToDateTimeOffset((DateTime)value);
1745if (destinationType == StringType) return this.ToString((DateTime)value);
1746if (destinationType == XmlAtomicValueType) return (new XmlAtomicValue(SchemaType, (DateTime)value));
1747if (destinationType == XPathItemType) return (new XmlAtomicValue(SchemaType, (DateTime)value));
1794if (sourceType == DateTimeType) return (new XmlAtomicValue(SchemaType, (DateTime)value));
1801if (sourceType == DateTimeType) return (new XmlAtomicValue(SchemaType, (DateTime)value));
2442public override DateTime ToDateTime(string value)
2448public override DateTime ToDateTime(object value)
2456return (DateTime)ChangeTypeWildcardDestination(value, DateTimeType, null);
2599public override string ToString(DateTime value)
2601return DateTimeToString((DateTime)value);
2642if (sourceType == DateTimeType) return DateTimeToString((DateTime)value);
2678public override object ChangeType(DateTime value, Type destinationType)
2683if (destinationType == StringType) return DateTimeToString((DateTime)value);
3072public override DateTime ToDateTime(object value)
3080return (DateTime)ChangeTypeWildcardDestination(value, DateTimeType, null);
3200public override object ChangeType(DateTime value, Type destinationType)
3205if (destinationType == XmlAtomicValueType) return (new XmlAtomicValue(XmlSchemaType.GetBuiltInSimpleType(XmlTypeCode.DateTime), (DateTime)value));
3327if (sourceType == DateTimeType) return (new XmlAtomicValue(XmlSchemaType.GetBuiltInSimpleType(XmlTypeCode.DateTime), (DateTime)value));
3517if (itemTypeDst == DateTimeType) return ToArray<DateTime>(value, nsResolver);
FrameworkFork\Microsoft.Xml\Xml\schema\XsdDateTime.cs (24)
40private DateTime _dt;
161public XsdDateTime(DateTime dateTime, XsdDateTimeFlags kinds)
365public DateTime ToZulu()
402public static implicit operator DateTime(XsdDateTime xdt)
404DateTime result;
409result = new DateTime(DateTime.Now.Year, xdt.Month, xdt.Day);
413DateTime currentDateTime = DateTime.Now;
432if (ticks < DateTime.MinValue.Ticks)
436if (ticks < DateTime.MinValue.Ticks)
437ticks = DateTime.MinValue.Ticks;
445if (ticks > DateTime.MaxValue.Ticks)
449if (ticks > DateTime.MaxValue.Ticks)
450ticks = DateTime.MaxValue.Ticks;
463DateTime dt;
469dt = new DateTime(DateTime.Now.Year, xdt.Month, xdt.Day);
473DateTime currentDateTime = DateTime.Now;
511return DateTime.Compare(left._dt, right._dt);
521return DateTime.Compare(left.GetZuluDateTime(), right.GetZuluDateTime());
690private DateTime GetZuluDateTime()
863Parse2Dig(start + s_lz__mm_, ref day) && 1 <= day && day <= DateTime.DaysInMonth(leapYear, month) &&
890Parse2Dig(start + s_Lz___, ref day) && 1 <= day && day <= DateTime.DaysInMonth(leapYear, firstMonth) &&
912Parse2Dig(start + s_lzyyyy_MM_, ref day) && 1 <= day && day <= DateTime.DaysInMonth(year, month);
FrameworkFork\Microsoft.Xml\Xml\Serialization\Types.cs (6)
533AddPrimitive(typeof(DateTime), "dateTime", "DateTime", TypeFlags.CanBeAttributeValue | TypeFlags.CanBeElementValue | TypeFlags.HasCustomFormatter | TypeFlags.XmlEncodingNotRequired);
542AddPrimitive(typeof(DateTime), "date", "Date", TypeFlags.AmbiguousDataType | TypeFlags.CanBeAttributeValue | TypeFlags.CanBeElementValue | TypeFlags.HasCustomFormatter | TypeFlags.XmlEncodingNotRequired);
543AddPrimitive(typeof(DateTime), "time", "Time", TypeFlags.AmbiguousDataType | TypeFlags.CanBeAttributeValue | TypeFlags.CanBeElementValue | TypeFlags.HasCustomFormatter | TypeFlags.XmlEncodingNotRequired);
629AddSoapEncodedPrimitive(typeof(DateTime), "dateTime", ns, "DateTime", new XmlQualifiedName("string", XmlSchema.Namespace), TypeFlags.CanBeAttributeValue | TypeFlags.CanBeElementValue | TypeFlags.HasCustomFormatter | TypeFlags.XmlEncodingNotRequired);
638AddSoapEncodedPrimitive(typeof(DateTime), "date", ns, "Date", new XmlQualifiedName("string", XmlSchema.Namespace), TypeFlags.AmbiguousDataType | TypeFlags.CanBeAttributeValue | TypeFlags.CanBeElementValue | TypeFlags.HasCustomFormatter | TypeFlags.XmlEncodingNotRequired);
639AddSoapEncodedPrimitive(typeof(DateTime), "time", ns, "Time", new XmlQualifiedName("string", XmlSchema.Namespace), TypeFlags.AmbiguousDataType | TypeFlags.CanBeAttributeValue | TypeFlags.CanBeElementValue | TypeFlags.HasCustomFormatter | TypeFlags.XmlEncodingNotRequired);
FrameworkFork\Microsoft.Xml\Xml\XmlConvert.cs (15)
830public static string ToString(DateTime value)
839public static string ToString(DateTime value, string format)
847public static string ToString(DateTime value, XmlDateTimeSerializationMode dateTimeOption)
1371public static DateTime ToDateTime(string s)
1380public static DateTime ToDateTime(string s, string format)
1382return DateTime.ParseExact(s, format, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AllowLeadingWhite | DateTimeStyles.AllowTrailingWhite);
1389public static DateTime ToDateTime(string s, string[] formats)
1391return DateTime.ParseExact(s, formats, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AllowLeadingWhite | DateTimeStyles.AllowTrailingWhite);
1398public static DateTime ToDateTime(string s, XmlDateTimeSerializationMode dateTimeOption)
1401DateTime dt = (DateTime)xsdDateTime;
1485private static DateTime SwitchToLocalTime(DateTime value)
1501private static DateTime SwitchToUtcTime(DateTime value)
FrameworkFork\System.Runtime.Serialization\System\Xml\ArrayHelper.cs (6)
308internal class DateTimeArrayHelperWithString : ArrayHelper<string, DateTime>
312protected override int ReadArray(XmlDictionaryReader reader, string localName, string namespaceUri, DateTime[] array, int offset, int count)
317protected override void WriteArray(XmlDictionaryWriter writer, string prefix, string localName, string namespaceUri, DateTime[] array, int offset, int count)
323internal class DateTimeArrayHelperWithDictionaryString : ArrayHelper<XmlDictionaryString, DateTime>
327protected override int ReadArray(XmlDictionaryReader reader, XmlDictionaryString localName, XmlDictionaryString namespaceUri, DateTime[] array, int offset, int count)
332protected override void WriteArray(XmlDictionaryWriter writer, string prefix, XmlDictionaryString localName, XmlDictionaryString namespaceUri, DateTime[] array, int offset, int count)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBinaryReader.cs (6)
224public override DateTime ReadElementContentAsDateTime()
231DateTime value = BufferReader.ReadDateTime();
1167type = typeof(DateTime);
1444private int ReadArray(DateTime[] array, int offset, int count)
1456public override int ReadArray(string localName, string namespaceUri, DateTime[] array, int offset, int count)
1463public override int ReadArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri, DateTime[] array, int offset, int count)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBinaryWriter.cs (6)
847public override void WriteDateTimeText(DateTime dt)
851private static long ToBinary(DateTime dt)
953public void WriteDateTimeArray(DateTime[] array, int offset, int count)
1204else if (type == typeof(DateTime))
1555public override void WriteArray(string prefix, string localName, string namespaceUri, DateTime[] array, int offset, int count)
1568public override void WriteArray(string prefix, XmlDictionaryString localName, XmlDictionaryString namespaceUri, DateTime[] array, int offset, int count)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlDictionaryAsyncCheckWriter.cs (2)
492public override void WriteArray(string prefix, string localName, string namespaceUri, DateTime[] array, int offset, int count)
498public override void WriteArray(string prefix, XmlDictionaryString localName, XmlDictionaryString namespaceUri, DateTime[] array, int offset, int count)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlDictionaryReader.cs (8)
716public override DateTime ReadElementContentAsDateTime()
719DateTime value;
726value = DateTime.Parse(string.Empty, NumberFormatInfo.InvariantInfo);
1117public virtual DateTime[] ReadDateTimeArray(string localName, string namespaceUri)
1122public virtual DateTime[] ReadDateTimeArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri)
1127public virtual int ReadArray(string localName, string namespaceUri, DateTime[] array, int offset, int count)
1139public virtual int ReadArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri, DateTime[] array, int offset, int count)
1538public override DateTime ReadContentAsDateTime()
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlDictionaryWriter.cs (4)
272else if (type == typeof(DateTime))
301else if (type == typeof(DateTime))
537public virtual void WriteArray(string prefix, string localName, string namespaceUri, DateTime[] array, int offset, int count)
548public virtual void WriteArray(string prefix, XmlDictionaryString localName, XmlDictionaryString namespaceUri, DateTime[] array, int offset, int count)
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\Tokens\SecurityContextSecurityToken.cs (39)
20private DateTime _keyEffectiveTime;
21private DateTime _keyExpirationTime;
22private DateTime _tokenEffectiveTime;
23private DateTime _tokenExpirationTime;
33public SecurityContextSecurityToken(UniqueId contextId, byte[] key, DateTime validFrom, DateTime validTo)
37public SecurityContextSecurityToken(UniqueId contextId, string id, byte[] key, DateTime validFrom, DateTime validTo)
41public SecurityContextSecurityToken(UniqueId contextId, string id, byte[] key, DateTime validFrom, DateTime validTo, ReadOnlyCollection<IAuthorizationPolicy> authorizationPolicies)
48public SecurityContextSecurityToken(UniqueId contextId, string id, byte[] key, DateTime validFrom, DateTime validTo, UniqueId keyGeneration, DateTime keyEffectiveTime, DateTime keyExpirationTime, ReadOnlyCollection<IAuthorizationPolicy> authorizationPolicies)
60internal SecurityContextSecurityToken(SecurityContextSecurityToken sourceToken, string id, byte[] key, UniqueId keyGeneration, DateTime keyEffectiveTime, DateTime keyExpirationTime, ReadOnlyCollection<IAuthorizationPolicy> authorizationPolicies)
69internal SecurityContextSecurityToken(UniqueId contextId, string id, byte[] key, DateTime validFrom, DateTime validTo, ReadOnlyCollection<IAuthorizationPolicy> authorizationPolicies, bool isCookieMode, byte[] cookieBlob)
74internal SecurityContextSecurityToken(UniqueId contextId, string id, byte[] key, DateTime validFrom, DateTime validTo, ReadOnlyCollection<IAuthorizationPolicy> authorizationPolicies, bool isCookieMode, byte[] cookieBlob,
75UniqueId keyGeneration, DateTime keyEffectiveTime, DateTime keyExpirationTime)
139public DateTime KeyEffectiveTime
147public DateTime KeyExpirationTime
177public override DateTime ValidFrom
182public override DateTime ValidTo
209DateTime TimeBoundedCache.IExpirableItem.ExpirationTime
238private void Initialize(UniqueId contextId, byte[] key, DateTime validFrom, DateTime validTo, ReadOnlyCollection<IAuthorizationPolicy> authorizationPolicies, bool isCookieMode,
239UniqueId keyGeneration, DateTime keyEffectiveTime, DateTime keyExpirationTime)
251DateTime tokenEffectiveTimeUtc = validFrom.ToUniversalTime();
252DateTime tokenExpirationTimeUtc = validTo.ToUniversalTime();
283DateTime validFrom, DateTime validTo, ReadOnlyCollection<IAuthorizationPolicy> authorizationPolicies, SecurityStateEncoder securityStateEncoder)
290DateTime validFrom, DateTime validTo, UniqueId keyGeneration, DateTime keyEffectiveTime,
291DateTime keyExpirationTime, ReadOnlyCollection<IAuthorizationPolicy> authorizationPolicies, SecurityStateEncoder securityStateEncoder)
dotnet-svcutil-lib.Tests (3)
dotnet-user-jwts (8)
dotnet-watch (14)
dotnet-watch.Tests (4)
finalizer (1)
HelixTestRunner (2)
HostedBlazorWebassemblyApp.Server (2)
HostedBlazorWebassemblyApp.Shared (2)
HttpStress (1)
IdeCoreBenchmarks (39)
IIS.FunctionalTests (6)
IIS.LongTests (3)
IIS.NewHandler.FunctionalTests (3)
IIS.NewShim.FunctionalTests (3)
IIS.ShadowCopy.Tests (2)
IISExpress.FunctionalTests (7)
InMemory.FunctionalTests (1)
Interop.FunctionalTests (1)
InteropClient (20)
artifacts\obj\InteropClient\Release\net10.0\TestGrpc.cs (18)
191public virtual global::Grpc.Testing.Empty EmptyCall(global::Grpc.Testing.Empty request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
215public virtual grpc::AsyncUnaryCall<global::Grpc.Testing.Empty> EmptyCallAsync(global::Grpc.Testing.Empty request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
239public virtual global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
263public virtual grpc::AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
289public virtual global::Grpc.Testing.SimpleResponse CacheableUnaryCall(global::Grpc.Testing.SimpleRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
317public virtual grpc::AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> CacheableUnaryCallAsync(global::Grpc.Testing.SimpleRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
344public virtual grpc::AsyncServerStreamingCall<global::Grpc.Testing.StreamingOutputCallResponse> StreamingOutputCall(global::Grpc.Testing.StreamingOutputCallRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
369public virtual grpc::AsyncClientStreamingCall<global::Grpc.Testing.StreamingInputCallRequest, global::Grpc.Testing.StreamingInputCallResponse> StreamingInputCall(grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
394public virtual grpc::AsyncDuplexStreamingCall<global::Grpc.Testing.StreamingOutputCallRequest, global::Grpc.Testing.StreamingOutputCallResponse> FullDuplexCall(grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
421public virtual grpc::AsyncDuplexStreamingCall<global::Grpc.Testing.StreamingOutputCallRequest, global::Grpc.Testing.StreamingOutputCallResponse> HalfDuplexCall(grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
448public virtual global::Grpc.Testing.Empty UnimplementedCall(global::Grpc.Testing.Empty request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
474public virtual grpc::AsyncUnaryCall<global::Grpc.Testing.Empty> UnimplementedCallAsync(global::Grpc.Testing.Empty request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
593public virtual global::Grpc.Testing.Empty UnimplementedCall(global::Grpc.Testing.Empty request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
617public virtual grpc::AsyncUnaryCall<global::Grpc.Testing.Empty> UnimplementedCallAsync(global::Grpc.Testing.Empty request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
738public virtual global::Grpc.Testing.Empty Start(global::Grpc.Testing.ReconnectParams request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
748public virtual grpc::AsyncUnaryCall<global::Grpc.Testing.Empty> StartAsync(global::Grpc.Testing.ReconnectParams request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
758public virtual global::Grpc.Testing.ReconnectInfo Stop(global::Grpc.Testing.Empty request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
768public virtual grpc::AsyncUnaryCall<global::Grpc.Testing.ReconnectInfo> StopAsync(global::Grpc.Testing.Empty request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
JwtClientSample (1)
JwtSample (2)
Keycloak.ApiService (1)
KeyManagementSimulator (2)
LocalizationSample (6)
Metrics (7)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
737is nameof(DateTime)
Metrics.Legacy (7)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
737is nameof(DateTime)
Microsoft.Analyzers.Extra.Tests (1)
Microsoft.Analyzers.Local (7)
Microsoft.Analyzers.Local.Tests (14)
Json\JsonValueTest.cs (14)
73Assert.True(new JsonValue(DateTime.Now.ToString("o", CultureInfo.InvariantCulture)).IsDateTime);
160var now = new DateTime(2016, 1, 20, 5, 12, 33, DateTimeKind.Local);
209DateTime time = DateTime.Now;
213Assert.Equal(default(DateTime?), JsonValue.Null);
296Assert.Equal(DateTime.MinValue, (DateTime)new JsonValue(false));
297Assert.Equal(DateTime.MinValue, (DateTime)new JsonValue("Some text"));
299var now = new DateTime(2016, 1, 20, 5, 12, 33, DateTimeKind.Local);
300Assert.Equal(now, (DateTime)new JsonValue(now.ToString("o", CultureInfo.InvariantCulture)));
303Assert.Null((DateTime?)new JsonValue(false));
304Assert.Null((DateTime?)new JsonValue("Some text"));
305Assert.Equal(now, (DateTime?)new JsonValue(now.ToString("o", CultureInfo.InvariantCulture)));
Microsoft.AspNetCore.Authentication (1)
Microsoft.AspNetCore.Authentication.Certificate (1)
Microsoft.AspNetCore.Authentication.JwtBearer (3)
Microsoft.AspNetCore.Authentication.JwtBearer.Tools.Tests (2)
Microsoft.AspNetCore.Authentication.OpenIdConnect (8)
Microsoft.AspNetCore.Authentication.Test (43)
JwtBearerTests.cs (11)
61expires: DateTime.Now.AddMinutes(30),
98expires: DateTime.Now.AddMinutes(30),
930notBefore: DateTime.Now.AddMinutes(-10),
931expires: DateTime.Now.AddMinutes(30),
975expires: new DateTime(DateTime.MaxValue.Ticks, DateTimeKind.Utc),
1003var elementValueUtc = DateTime.Parse(expiresElement.GetString(), CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal);
1006var max = DateTime.Parse(DateTime.MaxValue.ToString(CultureInfo.InvariantCulture), CultureInfo.InvariantCulture);
1286expires: DateTime.Now.AddMinutes(30),
JwtBearerTests_Handler.cs (11)
54expires: DateTime.Now.AddMinutes(30),
90expires: DateTime.Now.AddMinutes(30),
876notBefore: DateTime.Now.AddMinutes(-10),
877expires: DateTime.Now.AddMinutes(30),
920expires: new DateTime(DateTime.MaxValue.Ticks, DateTimeKind.Utc),
947var elementValueUtc = DateTime.Parse(expiresElement.GetString(), CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal);
950var max = DateTime.Parse(DateTime.MaxValue.ToString(CultureInfo.InvariantCulture), CultureInfo.InvariantCulture);
1354expires: DateTime.Now.AddMinutes(30),
OpenIdConnect\OpenIdConnectTests.cs (17)
408DateTime utcNow = DateTime.UtcNow;
410Assert.Equal(DateTime.MaxValue, GetNonceExpirationTime(noncePrefix + DateTime.MaxValue.Ticks.ToString(CultureInfo.InvariantCulture) + nonceDelimiter, TimeSpan.FromHours(1)));
412Assert.Equal(DateTime.MinValue + TimeSpan.FromHours(1), GetNonceExpirationTime(noncePrefix + DateTime.MinValue.Ticks.ToString(CultureInfo.InvariantCulture) + nonceDelimiter, TimeSpan.FromHours(1)));
416Assert.Equal(DateTime.MinValue, GetNonceExpirationTime(noncePrefix, TimeSpan.FromHours(1)));
418Assert.Equal(DateTime.MinValue, GetNonceExpirationTime("", TimeSpan.FromHours(1)));
420Assert.Equal(DateTime.MinValue, GetNonceExpirationTime(noncePrefix + noncePrefix, TimeSpan.FromHours(1)));
424Assert.Equal(DateTime.MinValue, GetNonceExpirationTime(utcNow.Ticks.ToString(CultureInfo.InvariantCulture) + nonceDelimiter + utcNow.Ticks.ToString(CultureInfo.InvariantCulture) + nonceDelimiter, TimeSpan.FromHours(1)));
573private static DateTime GetNonceExpirationTime(string keyname, TimeSpan nonceLifetime)
575DateTime nonceTime = DateTime.MinValue;
588nonceTime = DateTime.FromBinary(Convert.ToInt64(timestamp, CultureInfo.InvariantCulture));
589if ((nonceTime >= DateTime.UtcNow) && ((DateTime.MaxValue - nonceTime) < nonceLifetime))
591nonceTime = DateTime.MaxValue;
Microsoft.AspNetCore.Authentication.WsFederation (4)
Microsoft.AspNetCore.Components (82)
BindConverter.cs (43)
327public static string FormatValue(DateTime value, CultureInfo? culture = null) => FormatDateTimeValueCore(value, format: null, culture);
339public static string FormatValue(DateTime value, [StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string format, CultureInfo? culture = null) => FormatDateTimeValueCore(value, format, culture);
341private static string FormatDateTimeValueCore(DateTime value, string? format, CultureInfo? culture)
351private static string FormatDateTimeValueCore(DateTime value, CultureInfo? culture)
365public static string? FormatValue(DateTime? value, CultureInfo? culture = null) => FormatNullableDateTimeValueCore(value, format: null, culture);
371/// <param name="format">The format to use. Provided to <see cref="DateTime.ToString(string, IFormatProvider)"/>.</param>
377public static string? FormatValue(DateTime? value, [StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string? format, CultureInfo? culture = null) => FormatNullableDateTimeValueCore(value, format, culture);
379private static string? FormatNullableDateTimeValueCore(DateTime? value, string? format, CultureInfo? culture)
394private static string? FormatNullableDateTimeValueCore(DateTime? value, CultureInfo? culture)
606return DateTime.MinValue.Add(value.ToTimeSpan()).ToString(format, culture ?? CultureInfo.CurrentCulture);
650return DateTime.MinValue.Add(value.Value.ToTimeSpan()).ToString(format, culture ?? CultureInfo.CurrentCulture);
1168/// Attempts to convert a value to a <see cref="System.DateTime"/>.
1174public static bool TryConvertToDateTime(object? obj, CultureInfo? culture, out DateTime value)
1180/// Attempts to convert a value to a <see cref="System.DateTime"/>.
1187public static bool TryConvertToDateTime(object? obj, CultureInfo? culture, [StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string format, out DateTime value)
1193/// Attempts to convert a value to a nullable <see cref="System.DateTime"/>.
1199public static bool TryConvertToNullableDateTime(object? obj, CultureInfo? culture, out DateTime? value)
1205/// Attempts to convert a value to a nullable <see cref="System.DateTime"/>.
1212public static bool TryConvertToNullableDateTime(object? obj, CultureInfo? culture, [StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string format, out DateTime? value)
1217internal static BindParser<DateTime> ConvertToDateTime = ConvertToDateTimeCore;
1218internal static BindParserWithFormat<DateTime> ConvertToDateTimeWithFormat = ConvertToDateTimeCore;
1219internal static BindParser<DateTime?> ConvertToNullableDateTime = ConvertToNullableDateTimeCore;
1220internal static BindParserWithFormat<DateTime?> ConvertToNullableDateTimeWithFormat = ConvertToNullableDateTimeCore;
1222private static bool ConvertToDateTimeCore(object? obj, CultureInfo? culture, out DateTime value)
1227private static bool ConvertToDateTimeCore(object? obj, CultureInfo? culture, string? format, out DateTime value)
1236if (format != null && DateTime.TryParseExact(text, format, culture ?? CultureInfo.CurrentCulture, DateTimeStyles.None, out var converted))
1241else if (format == null && DateTime.TryParse(text, culture ?? CultureInfo.CurrentCulture, DateTimeStyles.None, out converted))
1251private static bool ConvertToNullableDateTimeCore(object? obj, CultureInfo? culture, out DateTime? value)
1256private static bool ConvertToNullableDateTimeCore(object? obj, CultureInfo? culture, string? format, out DateTime? value)
1265if (format != null && DateTime.TryParseExact(text, format, culture ?? CultureInfo.CurrentCulture, DateTimeStyles.None, out var converted))
1270else if (format == null && DateTime.TryParse(text, culture ?? CultureInfo.CurrentCulture, DateTimeStyles.None, out converted))
1456if (ConvertToDateTimeCore(obj, culture, format, out var dateTime))
1474if (ConvertToDateTimeCore(obj, culture, format, out var dateTime))
1547if (ConvertToDateTimeCore(obj, culture, format, out var dateTime))
1565if (ConvertToDateTimeCore(obj, culture, format, out var dateTime))
1759else if (typeof(T) == typeof(DateTime))
1761formatter = (BindFormatter<DateTime>)FormatDateTimeValueCore;
1763else if (typeof(T) == typeof(DateTime?))
1765formatter = (BindFormatter<DateTime?>)FormatNullableDateTimeValueCore;
1958else if (typeof(T) == typeof(DateTime))
1962else if (typeof(T) == typeof(DateTime?))
EventCallbackFactoryBinderExtensions.cs (24)
638Action<DateTime> setter,
639DateTime existingValue,
642return CreateBinderCore<DateTime>(factory, receiver, setter, culture, ConvertToDateTime);
658Func<DateTime, Task> setter,
659DateTime existingValue,
662return CreateBinderCoreAsync<DateTime>(factory, receiver, setter, culture, ConvertToDateTime);
679Action<DateTime> setter,
680DateTime existingValue,
684return CreateBinderCore<DateTime>(factory, receiver, setter, culture, format, ConvertToDateTimeWithFormat);
701Func<DateTime, Task> setter,
702DateTime existingValue,
706return CreateBinderCoreAsync<DateTime>(factory, receiver, setter, culture, format, ConvertToDateTimeWithFormat);
722Action<DateTime?> setter,
723DateTime? existingValue,
726return CreateBinderCore<DateTime?>(factory, receiver, setter, culture, ConvertToNullableDateTime);
742Func<DateTime?, Task> setter,
743DateTime? existingValue,
746return CreateBinderCoreAsync<DateTime?>(factory, receiver, setter, culture, ConvertToNullableDateTime);
763Action<DateTime?> setter,
764DateTime? existingValue,
768return CreateBinderCore<DateTime?>(factory, receiver, setter, culture, format, ConvertToNullableDateTimeWithFormat);
785Func<DateTime?, Task> setter,
786DateTime? existingValue,
790return CreateBinderCoreAsync<DateTime?>(factory, receiver, setter, culture, format, ConvertToNullableDateTimeWithFormat);
Microsoft.AspNetCore.Components.Endpoints (6)
Microsoft.AspNetCore.Components.Endpoints.Tests (5)
Binding\FormDataMapperTests.cs (4)
2125{ "4/20/2023 12:56:34", typeof(DateTime?), new DateTime?(new DateTime(2023, 04, 20, 12, 56, 34))},
2167{ typeof(DateTime?) },
2210{ "4/20/2023 12:56:34", typeof(DateTime), new DateTime(2023, 04, 20, 12, 56, 34) },
Microsoft.AspNetCore.Components.Forms.Tests (1)
Microsoft.AspNetCore.Components.QuickGrid.Tests (6)
Microsoft.AspNetCore.Components.Server (9)
Microsoft.AspNetCore.Components.Tests (54)
EventCallbackFactoryBinderExtensionsTest.cs (20)
387var value = DateTime.Now;
389Action<DateTime> setter = (_) => value = _;
393var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3);
406var value = (DateTime?)DateTime.Now;
408Action<DateTime?> setter = (_) => value = _;
412var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3);
425var value = DateTime.Now;
427Action<DateTime> setter = (_) => value = _;
432var expectedValue = new DateTime(2018, 3, 4);
445var value = (DateTime?)DateTime.Now;
447Action<DateTime?> setter = (_) => value = _;
452var expectedValue = new DateTime(2018, 3, 4);
471var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3);
490var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3);
510var expectedValue = new DateTime(2018, 3, 4);
530var expectedValue = new DateTime(2018, 3, 4);
Routing\QueryParameterValueSupplierTest.cs (19)
35AssertKeyValuePair<DateTime>("DateTimeVal", new DateTimeOffset(2020, 1, 2, 3, 4, 5, 678, TimeSpan.FromHours(-9)).LocalDateTime);
43AssertKeyValuePair<DateTime?>("NullableDateTimeVal", new DateTime(2021, 1, 2, 3, 4, 5, 678, DateTimeKind.Utc).ToLocalTime());
66AssertKeyValuePair<DateTime>("DateTimeVal", null);
74AssertKeyValuePair<DateTime?>("NullableDateTimeVal", null);
109AssertKeyValuePair<DateTime[]>("DateTimeVals", new[] { new DateTime(2020, 1, 2, 3, 4, 5, 678, DateTimeKind.Utc).ToLocalTime() });
117AssertKeyValuePair<DateTime?[]>("NullableDateTimeVals", new[] { new DateTime(2021, 1, 2, 3, 4, 5, 678, DateTimeKind.Utc).ToLocalTime() });
136AssertKeyValuePair<DateTime[]>("DateTimeVals", Array.Empty<DateTime>());
144AssertKeyValuePair<DateTime?[]>("NullableDateTimeVals", Array.Empty<DateTime?>());
156[InlineData("DateTimeVal", "2020-02-31", typeof(DateTime))]
164[InlineData("NullableDateTimeVal", "2020-02-31", typeof(DateTime?))]
181[InlineData("DateTimeVals", "2020-02-28", "2020-02-31", typeof(DateTime))]
189[InlineData("NullableDateTimeVals", "2020-02-28", "2020-02-31", typeof(DateTime?))]
206[InlineData("DateTimeVal", typeof(DateTime))]
237AssertKeyValuePair<DateTime?>("NullableDateTimeVal", null);
271[InlineData("DateTimeVals", typeof(DateTime))]
303AssertKeyValuePair<DateTime?[]>("NullableDateTimeVals", new DateTime?[] { null });
Microsoft.AspNetCore.Components.Web (3)
Microsoft.AspNetCore.Components.Web.Tests (17)
Microsoft.AspNetCore.DataProtection (12)
Microsoft.AspNetCore.DataProtection.Extensions.Tests (4)
Microsoft.AspNetCore.DataProtection.Tests (21)
Microsoft.AspNetCore.Diagnostics.Tests (4)
Microsoft.AspNetCore.Grpc.JsonTranscoding (6)
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (40)
artifacts\obj\Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests\Release\net10.0\Proto\TranscodingGrpc.cs (34)
223public virtual global::Transcoding.HelloReply SayHello(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
233public virtual grpc::AsyncUnaryCall<global::Transcoding.HelloReply> SayHelloAsync(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
243public virtual global::Transcoding.HelloReply ResponseBody(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
253public virtual grpc::AsyncUnaryCall<global::Transcoding.HelloReply> ResponseBodyAsync(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
263public virtual global::Transcoding.HelloReply Custom(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
273public virtual grpc::AsyncUnaryCall<global::Transcoding.HelloReply> CustomAsync(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
283public virtual global::Transcoding.HelloReply AdditionalBindings(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
293public virtual grpc::AsyncUnaryCall<global::Transcoding.HelloReply> AdditionalBindingsAsync(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
303public virtual global::Transcoding.HelloReply NoOption(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
313public virtual grpc::AsyncUnaryCall<global::Transcoding.HelloReply> NoOptionAsync(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
323public virtual grpc::AsyncServerStreamingCall<global::Transcoding.HelloReply> ServerStreamingGetOption(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
333public virtual global::Transcoding.HelloReply Body(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
343public virtual grpc::AsyncUnaryCall<global::Transcoding.HelloReply> BodyAsync(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
353public virtual global::Transcoding.HelloReply SubBody(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
363public virtual grpc::AsyncUnaryCall<global::Transcoding.HelloReply> SubBodyAsync(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
373public virtual global::Transcoding.HelloReply SubRepeatedBody(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
383public virtual grpc::AsyncUnaryCall<global::Transcoding.HelloReply> SubRepeatedBodyAsync(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
532public virtual global::Transcoding.HelloReply BadResponseBody(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
542public virtual grpc::AsyncUnaryCall<global::Transcoding.HelloReply> BadResponseBodyAsync(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
675public virtual global::Transcoding.HelloReply BadResponseBody(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
685public virtual grpc::AsyncUnaryCall<global::Transcoding.HelloReply> BadResponseBodyAsync(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
818public virtual global::Transcoding.HelloReply BadBody(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
828public virtual grpc::AsyncUnaryCall<global::Transcoding.HelloReply> BadBodyAsync(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
961public virtual global::Transcoding.HelloReply BadBody(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
971public virtual grpc::AsyncUnaryCall<global::Transcoding.HelloReply> BadBodyAsync(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
1104public virtual global::Transcoding.HelloReply BadPattern(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
1114public virtual grpc::AsyncUnaryCall<global::Transcoding.HelloReply> BadPatternAsync(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
1275public virtual grpc::AsyncServerStreamingCall<global::Transcoding.HelloReply> GetServerStreaming(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
1285public virtual grpc::AsyncClientStreamingCall<global::Transcoding.HelloRequest, global::Transcoding.HelloReply> GetClientStreaming(grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
1295public virtual grpc::AsyncDuplexStreamingCall<global::Transcoding.HelloRequest, global::Transcoding.HelloReply> GetBidiStreaming(grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
1446public virtual global::Transcoding.HelloReply StartFrameImport(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
1456public virtual grpc::AsyncUnaryCall<global::Transcoding.HelloReply> StartFrameImportAsync(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
1466public virtual global::Transcoding.HelloReply GetFrameImport(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
1476public virtual grpc::AsyncUnaryCall<global::Transcoding.HelloReply> GetFrameImportAsync(global::Transcoding.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
Microsoft.AspNetCore.Grpc.Microbenchmarks (3)
Microsoft.AspNetCore.Grpc.Swagger (4)
Microsoft.AspNetCore.Grpc.Swagger.Tests (52)
artifacts\obj\Microsoft.AspNetCore.Grpc.Swagger.Tests\Release\net10.0\Proto\BodyGrpc.cs (8)
153public virtual global::Body.BodyParamResponse DemoBodyOne(global::Body.RequestOne request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
163public virtual grpc::AsyncUnaryCall<global::Body.BodyParamResponse> DemoBodyOneAsync(global::Body.RequestOne request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
173public virtual global::Body.BodyParamResponse DemoBodyTwo(global::Body.RequestOne request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
183public virtual grpc::AsyncUnaryCall<global::Body.BodyParamResponse> DemoBodyTwoAsync(global::Body.RequestOne request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
193public virtual global::Body.BodyParamResponse DemoBodyThree(global::Body.RequestOne request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
203public virtual grpc::AsyncUnaryCall<global::Body.BodyParamResponse> DemoBodyThreeAsync(global::Body.RequestOne request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
213public virtual global::Body.BodyParamResponse DemoBodyFour(global::Body.RequestOne request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
223public virtual grpc::AsyncUnaryCall<global::Body.BodyParamResponse> DemoBodyFourAsync(global::Body.RequestOne request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
artifacts\obj\Microsoft.AspNetCore.Grpc.Swagger.Tests\Release\net10.0\Proto\ParametersGrpc.cs (22)
309public virtual global::Params.ParamResponse DemoParametersOne(global::Params.RequestOne request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
333public virtual grpc::AsyncUnaryCall<global::Params.ParamResponse> DemoParametersOneAsync(global::Params.RequestOne request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
357public virtual global::Params.ParamResponse DemoParametersTwo(global::Params.RequestOne request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
381public virtual grpc::AsyncUnaryCall<global::Params.ParamResponse> DemoParametersTwoAsync(global::Params.RequestOne request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
405public virtual global::Params.ParamResponse DemoParametersThree(global::Params.RequestTwo request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
429public virtual grpc::AsyncUnaryCall<global::Params.ParamResponse> DemoParametersThreeAsync(global::Params.RequestTwo request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
453public virtual global::Params.ParamResponse DemoParametersFour(global::Params.RequestTwo request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
477public virtual grpc::AsyncUnaryCall<global::Params.ParamResponse> DemoParametersFourAsync(global::Params.RequestTwo request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
501public virtual global::Params.ParamResponse DemoParametersFive(global::Params.RequestTwo request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
525public virtual grpc::AsyncUnaryCall<global::Params.ParamResponse> DemoParametersFiveAsync(global::Params.RequestTwo request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
549public virtual global::Params.ParamResponse DemoParametersSix(global::Params.RequestThree request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
573public virtual grpc::AsyncUnaryCall<global::Params.ParamResponse> DemoParametersSixAsync(global::Params.RequestThree request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
597public virtual global::Params.ParamResponse DemoParametersSeven(global::Params.RequestFour request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
621public virtual grpc::AsyncUnaryCall<global::Params.ParamResponse> DemoParametersSevenAsync(global::Params.RequestFour request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
637public virtual global::Params.ParamResponse DemoParametersEight(global::Params.RequestFour request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
647public virtual grpc::AsyncUnaryCall<global::Params.ParamResponse> DemoParametersEightAsync(global::Params.RequestFour request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
657public virtual global::Params.ParamResponse DemoParametersNine(global::Params.RequestFive request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
667public virtual grpc::AsyncUnaryCall<global::Params.ParamResponse> DemoParametersNineAsync(global::Params.RequestFive request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
677public virtual global::Params.ParamResponse DemoParametersTenOne(global::Params.RequestOne request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
687public virtual grpc::AsyncUnaryCall<global::Params.ParamResponse> DemoParametersTenOneAsync(global::Params.RequestOne request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
697public virtual global::Params.ParamResponse DemoParametersTenTwo(global::Params.RequestOne request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
707public virtual grpc::AsyncUnaryCall<global::Params.ParamResponse> DemoParametersTenTwoAsync(global::Params.RequestOne request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
artifacts\obj\Microsoft.AspNetCore.Grpc.Swagger.Tests\Release\net10.0\Proto\ResponsebodyGrpc.cs (8)
153public virtual global::ResponseBody.BodyParamResponse DemoBodyOne(global::ResponseBody.Request request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
163public virtual grpc::AsyncUnaryCall<global::ResponseBody.BodyParamResponse> DemoBodyOneAsync(global::ResponseBody.Request request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
173public virtual global::ResponseBody.BodyParamResponse DemoBodyTwo(global::ResponseBody.Request request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
183public virtual grpc::AsyncUnaryCall<global::ResponseBody.BodyParamResponse> DemoBodyTwoAsync(global::ResponseBody.Request request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
193public virtual global::ResponseBody.BodyParamResponse DemoBodyThree(global::ResponseBody.Request request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
203public virtual grpc::AsyncUnaryCall<global::ResponseBody.BodyParamResponse> DemoBodyThreeAsync(global::ResponseBody.Request request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
213public virtual global::ResponseBody.BodyParamResponse DemoBodyFour(global::ResponseBody.Request request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
223public virtual grpc::AsyncUnaryCall<global::ResponseBody.BodyParamResponse> DemoBodyFourAsync(global::ResponseBody.Request request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
artifacts\obj\Microsoft.AspNetCore.Grpc.Swagger.Tests\Release\net10.0\Proto\XmldocGrpc.cs (10)
210public virtual global::Xmldoc.StringReply BasicGet(global::Xmldoc.StringRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
234public virtual grpc::AsyncUnaryCall<global::Xmldoc.StringReply> BasicGetAsync(global::Xmldoc.StringRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
258public virtual global::Xmldoc.StringReply BodyRootPost(global::Xmldoc.StringRequestWithDetail request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
282public virtual grpc::AsyncUnaryCall<global::Xmldoc.StringReply> BodyRootPostAsync(global::Xmldoc.StringRequestWithDetail request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
306public virtual global::Xmldoc.StringReply BodyPathPost(global::Xmldoc.StringRequestWithDetail request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
330public virtual grpc::AsyncUnaryCall<global::Xmldoc.StringReply> BodyPathPostAsync(global::Xmldoc.StringRequestWithDetail request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
354public virtual global::Xmldoc.StringReply BasicDelete(global::Xmldoc.StringRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
378public virtual grpc::AsyncUnaryCall<global::Xmldoc.StringReply> BasicDeleteAsync(global::Xmldoc.StringRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
402public virtual global::Xmldoc.StringReply QueryGet(global::Xmldoc.StringRequestWithDetail request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
426public virtual grpc::AsyncUnaryCall<global::Xmldoc.StringReply> QueryGetAsync(global::Xmldoc.StringRequestWithDetail request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
Microsoft.AspNetCore.Hosting (1)
Microsoft.AspNetCore.Http (1)
Microsoft.AspNetCore.Http.Connections.Tests (4)
HttpConnectionDispatcherTests.cs (4)
3208LifetimeValidator = (before, expires, token, parameters) => expires > DateTime.UtcNow,
3244var token = new JwtSecurityToken("SignalRTestServer", "SignalRTests", claims, expires: DateTime.UtcNow.AddMinutes(1), signingCredentials: credentials);
3370LifetimeValidator = (before, expires, token, parameters) => expires > DateTime.UtcNow,
3406var token = new JwtSecurityToken("SignalRTestServer", "SignalRTests", claims, expires: DateTime.UtcNow.AddMinutes(1), signingCredentials: credentials);
Microsoft.AspNetCore.Http.Extensions (11)
Microsoft.AspNetCore.Http.Microbenchmarks (3)
Microsoft.AspNetCore.Http.Tests (1)
Microsoft.AspNetCore.HttpLogging (10)
Microsoft.AspNetCore.HttpLogging.Tests (35)
FileLoggerProcessorTests.cs (5)
18private DateTime _today = new DateTime(2021, 01, 01, 12, 00, 00);
68var tomorrow = _today.AddDays(1);
587private static string GetLogFilePath(string path, string prefix, DateTime dateTime, int fileNumber)
592private static string GetLogFileName(string prefix, DateTime dateTime, int fileNumber)
597private static string GetLogFileBaseName(string prefix, DateTime dateTime)
Microsoft.AspNetCore.Identity (2)
Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test (2)
Microsoft.AspNetCore.Identity.Specification.Tests (1)
Microsoft.AspNetCore.Identity.UI (2)
Microsoft.AspNetCore.Mvc.Abstractions (5)
Microsoft.AspNetCore.Mvc.Abstractions.Test (2)
Microsoft.AspNetCore.Mvc.ApiExplorer (1)
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (4)
Microsoft.AspNetCore.Mvc.Core (7)
Microsoft.AspNetCore.Mvc.Core.Test (56)
Microsoft.AspNetCore.Mvc.DataAnnotations.Test (1)
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (12)
Microsoft.AspNetCore.Mvc.FunctionalTests (8)
AntiforgeryMiddlewareTest.cs (7)
47new("dueDate", DateTime.Today.AddDays(1).ToString(CultureInfo.CurrentCulture)),
88new("dueDate", DateTime.Today.AddDays(1).ToString(CultureInfo.CurrentCulture)),
131new("dueDate", DateTime.Today.AddDays(1).ToString(CultureInfo.CurrentCulture)),
163new("dueDate", DateTime.Today.AddDays(1).ToString(CultureInfo.CurrentCulture)),
195new("dueDate", DateTime.Today.AddDays(1).ToString(CultureInfo.CurrentCulture)),
250public DateTime DueDate { get; set; } = DateTime.Now.Add(TimeSpan.FromDays(1));
Microsoft.AspNetCore.Mvc.IntegrationTests (8)
Microsoft.AspNetCore.Mvc.NewtonsoftJson (2)
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (15)
src\Mvc\Mvc.ViewFeatures\test\Infrastructure\TempDataSerializerTestBase.cs (4)
137var value = new DateTime(2009, 1, 1, 12, 37, 43);
149var roundTripValue = Assert.IsType<DateTime>(values[key]);
181var value = new DateTime(2009, 1, 1, 12, 37, 43);
Microsoft.AspNetCore.Mvc.RazorPages.Test (4)
Microsoft.AspNetCore.Mvc.TagHelpers (2)
Microsoft.AspNetCore.Mvc.TagHelpers.Test (9)
Microsoft.AspNetCore.Mvc.ViewFeatures (5)
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (45)
CachedExpressionCompilerTest.cs (18)
417var model = new DateTime(2000, 1, 1);
418var expression = GetExpression<DateTime, int>(m => m.Year);
433var model = default(DateTime);
434var expression = GetExpression<DateTime, int>(m => m.Year);
449var model = new DateTime(2000, 1, 1);
450var nullableModel = (DateTime?)model;
451var expression = GetExpression<DateTime?, DateTime>(m => m.Value);
466var nullableModel = (DateTime?)null;
467var expression = GetExpression<DateTime?, DateTime>(m => m.Value);
482var dateTime = new DateTime(2000, 1, 1);
737var expected = new DateTime(2001, 1, 1);
742var expression = GetExpression<ValueType1, DateTime>(m => m.ValueType2.Date);
794var expression = GetExpression<ValueType1, DateTime>(m => m.NullableValueType2.Value.Date);
911public DateTime Date { get; set; }
952public DateTime Date { get; set; }
Infrastructure\TempDataSerializerTestBase.cs (4)
137var value = new DateTime(2009, 1, 1, 12, 37, 43);
149var roundTripValue = Assert.IsType<DateTime>(values[key]);
181var value = new DateTime(2009, 1, 1, 12, 37, 43);
Microsoft.AspNetCore.Mvc.Views.TestCommon (1)
Microsoft.AspNetCore.OpenApi (8)
Microsoft.AspNetCore.OpenApi.Microbenchmarks (1)
Microsoft.AspNetCore.OpenApi.Tests (85)
Services\CreateSchemaReferenceIdTests.cs (2)
164builder.MapPost("/", (Todo todo) => new TodoWithDueDate(todo.Id, todo.Title, todo.Completed, todo.CreatedAt, DateTime.UtcNow));
207builder.MapPost("/", (Todo todo) => new TodoWithDueDate(todo.Id, todo.Title, todo.Completed, todo.CreatedAt, DateTime.UtcNow));
Services\OpenApiDocumentService\OpenApiDocumentServiceTests.Responses.cs (3)
194builder.MapGet("/api/todos", [Produces("application/json", "application/xml")] () => new Todo(1, "Test todo", false, DateTime.Now));
358{ return TypedResults.Ok(new Todo(1, "Lorem", true, DateTime.UtcNow)); }); // This code doesn't return Bad Request, but that doesn't matter for this test.
389{ return TypedResults.Ok(new Todo(1, "Lorem", true, DateTime.UtcNow)); }); // This code doesn't return Bad Request, but that doesn't matter for this test.
Services\OpenApiSchemaService\OpenApiSchemaService.ParameterSchemas.cs (11)
83[(DateTime id) => {}, JsonSchemaType.String, "date-time"],
341[([Range(typeof(DateTime), "2024-02-01", "2024-02-031")] DateTime id) => {}, (OpenApiSchema schema) => { Assert.Null(schema.Minimum); Assert.Null(schema.Maximum); }],
377[([Range(typeof(DateTime), "2024-02-01", "2024-02-031")] DateTime id) => {}, (OpenApiSchema schema) => { Assert.Null(schema.Minimum); Assert.Null(schema.Maximum); }],
402[([Range(typeof(DateTime), "2024-02-01", "2024-02-031")] DateTime id) => {}, (OpenApiSchema schema) => { Assert.Null(schema.Minimum); Assert.Null(schema.Maximum); }],
440builder.MapGet("/api-4", ([Required][FromHeader] DateTime date) => { });
466[(DateTime[] id) => { }, JsonSchemaType.String, false],
467[(DateTime?[] id) => { }, JsonSchemaType.String, true],
611public DateTime Date { get; set; }
Services\OpenApiSchemaService\OpenApiSchemaService.ResponseSchemas.cs (18)
62builder.MapGet("/api", () => new Todo(1, "Test Title", true, DateTime.Now));
174static Todo? GetTodo() => Random.Shared.Next() < 0.5 ? new Todo(1, "Test Title", true, DateTime.Now) : null;
235static Task<Todo?> GetTodoAsync() => Task.FromResult(Random.Shared.Next() < 0.5 ? new Todo(1, "Test Title", true, DateTime.Now) : null);
282static ValueTask<Todo?> GetTodoValueTaskAsync() => ValueTask.FromResult(Random.Shared.Next() < 0.5 ? new Todo(1, "Test Title", true, DateTime.Now) : null);
441[new Todo(1, "Test", true, DateTime.Now)] : null;
443[new Todo(1, "Test", true, DateTime.Now)] : null;
445[new Todo(1, "Test", true, DateTime.Now)] : null;
558builder.MapGet("/api", () => new TodoWithDueDate(1, "Test Title", true, DateTime.Now, DateTime.Now.AddDays(1)));
612builder.MapGet("/api", () => new Result<Todo>(true, new TodoWithDueDate(1, "Test Title", true, DateTime.Now, DateTime.Now.AddDays(1)), null));
720builder.MapGet("/api", () => TypedResults.Created("/test/1", new { Id = 1, Name = "Test", Todo = new Todo(1, "Test", true, DateTime.Now) }));
782builder.MapGet("/", () => TypedResults.Ok<List<Todo>>([new Todo(1, "Test Title", true, DateTime.Now), new Todo(2, "Test Title 2", false, DateTime.Now)]));
829builder.MapGet("/", () => TypedResults.Ok<PaginatedItems<Todo>>(new(0, 1, 5, 50, [new Todo(1, "Test Title", true, DateTime.Now), new Todo(2, "Test Title 2", false, DateTime.Now)])));
969builder.MapGet("/", () => new ClassWithObjectProperty { Object = new Todo(1, "Test Title", true, DateTime.Now) });
1064internal Todo Get() => new(1, "Write test", false, DateTime.Now);
Shared\SharedTypes.cs (3)
20internal record Todo(int Id, string Title, bool Completed, DateTime CreatedAt);
30internal record TodoWithDueDate(int Id, string Title, bool Completed, DateTime CreatedAt, DateTime DueDate) : Todo(Id, Title, Completed, CreatedAt);
Transformers\DocumentTransformerTests.cs (3)
168builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
196builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
223builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
Transformers\OperationTransformerTests.cs (4)
406builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
433builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
460builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
461builder.MapGet("/todo-2", () => new Todo(1, "Item1", false, DateTime.Now));
Transformers\SchemaTransformerTests.cs (20)
64Assert.Equal(typeof(DateTime), context.JsonTypeInfo.Type);
74builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
97Assert.Equal(typeof(DateTime), context.JsonTypeInfo.Type);
111builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
129builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
182builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
213builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
243builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
266builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
290builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
328builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
365builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
391builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
527builder.MapGet("/list-of-todo", () => new List<Todo> { new Todo(1, "Item1", false, DateTime.Now) });
723builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
781builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
808builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
835builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
861builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
900builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
Transformers\TypeBasedTransformerLifetimeTests.cs (13)
16builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
38builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
64builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
90builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
115builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
137builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
162builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
188builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
213builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
234builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
257builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
283builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
309builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
Microsoft.AspNetCore.OutputCaching.StackExchangeRedis (3)
Microsoft.AspNetCore.Routing (3)
Microsoft.AspNetCore.Routing.FunctionalTests (25)
MinimalFormTests.cs (25)
60new KeyValuePair<string,string>("dueDate", DateTime.Today.AddDays(1).ToString(CultureInfo.InvariantCulture)),
70Assert.Equal(DateTime.Today.AddDays(1), result.DueDate);
92DueDate = DateTime.Parse(form["dueDate"], CultureInfo.InvariantCulture)
120new KeyValuePair<string,string>("dueDate", DateTime.Today.AddDays(1).ToString(CultureInfo.InvariantCulture)),
130Assert.Equal(DateTime.Today.AddDays(1), result.DueDate);
165new KeyValuePair<string,string>("dueDate", DateTime.Today.AddDays(1).ToString(CultureInfo.InvariantCulture)),
204new KeyValuePair<string,string>("dueDate", DateTime.Today.AddDays(1).ToString(CultureInfo.InvariantCulture)),
281new KeyValuePair<string,string>("dueDate", DateTime.Today.AddDays(1).ToString(CultureInfo.InvariantCulture)),
291Assert.Equal(DateTime.Today.AddDays(1), result.DueDate);
328new KeyValuePair<string,string>("dueDate", DateTime.Today.AddDays(1).ToString(CultureInfo.InvariantCulture)),
338Assert.Equal(DateTime.Today.AddDays(1), result.DueDate);
354DueDate = DateTime.Parse(form["dueDate"], CultureInfo.InvariantCulture)
368DueDate = DateTime.Parse(form["dueDate"], CultureInfo.InvariantCulture)
382DueDate = DateTime.Parse(form["dueDate"], CultureInfo.InvariantCulture)
424new KeyValuePair<string,string>("dueDate", DateTime.Today.AddDays(1).ToString(CultureInfo.InvariantCulture)),
481new KeyValuePair<string,string>("dueDate", DateTime.Today.AddDays(1).ToString(CultureInfo.InvariantCulture)),
498Assert.Equal(DateTime.Today.AddDays(1), result.DueDate);
542new KeyValuePair<string,string>("[dueDate]", DateTime.Today.AddDays(1).ToString(CultureInfo.InvariantCulture)),
543new KeyValuePair<string,string>("[dueDate1]", DateTime.Today.AddDays(1).ToString(CultureInfo.InvariantCulture)),
594new KeyValuePair<string,string>("[dueDate]", DateTime.Today.AddDays(1).ToString(CultureInfo.InvariantCulture)),
595new KeyValuePair<string,string>("[dueDate1]", DateTime.Today.AddDays(1).ToString(CultureInfo.InvariantCulture)),
646new KeyValuePair<string,string>("[dueDate]", DateTime.Today.AddDays(1).ToString(CultureInfo.InvariantCulture)),
647new KeyValuePair<string,string>("[dueDate1]", DateTime.Today.AddDays(1).ToString(CultureInfo.InvariantCulture)),
693new KeyValuePair<string,string>("dueDate", DateTime.Today.AddDays(1).ToString(CultureInfo.InvariantCulture)),
762public DateTime DueDate { get; set; }
Microsoft.AspNetCore.Routing.Tests (1)
Microsoft.AspNetCore.Server.HttpSys (1)
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (3)
Microsoft.AspNetCore.Server.IIS (1)
Microsoft.AspNetCore.Server.IntegrationTesting.IIS (2)
Microsoft.AspNetCore.Server.Kestrel.Core (1)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (3)
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (1)
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (2)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (2)
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (1)
Microsoft.AspNetCore.SignalR.Client.Core (9)
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (1)
Microsoft.AspNetCore.SignalR.Common.Tests (14)
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (2)
Microsoft.AspNetCore.SignalR.Tests (5)
Microsoft.AspNetCore.SignalR.Tests.Utils (3)
Microsoft.AspNetCore.StaticFiles.FunctionalTests (1)
Microsoft.AspNetCore.StaticFiles.Tests (1)
Microsoft.AspNetCore.Testing.Tests (2)
Microsoft.Build (156)
Logging\ParallelLogger\ParallelConsoleLogger.cs (5)
1362private bool WriteTargetMessagePrefix(BuildEventArgs e, BuildEventContext context, DateTime timeStamp)
1581private void WriteLinePrefix(BuildEventContext e, DateTime eventTimeStamp, bool isMessagePrefix)
1586private void WriteLinePrefix(string key, DateTime eventTimeStamp, bool isMessagePrefix)
1692internal void AddEventStarted(string projectTargetNames, BuildEventContext buildEventContext, DateTime eventTimeStamp, IEqualityComparer<BuildEventContext> comparer)
1719internal void AddEventFinished(string projectTargetNames, BuildEventContext buildEventContext, DateTime eventTimeStamp)
Microsoft.Build.BuildCheck.UnitTests (6)
Microsoft.Build.Engine.OM.UnitTests (19)
Microsoft.Build.Engine.UnitTests (113)
BackEnd\KnownTelemetry_Tests.cs (7)
63DateTime startAt = new DateTime(2023, 01, 02, 10, 11, 22);
64DateTime innerStartAt = new DateTime(2023, 01, 02, 10, 20, 30);
65DateTime finishedAt = new DateTime(2023, 12, 13, 14, 15, 16);
110buildTelemetry.StartAt = DateTime.MinValue;
115buildTelemetry.FinishedAt = DateTime.MaxValue;
118buildTelemetry.InnerStartAt = DateTime.MinValue;
123buildTelemetry.FinishedAt = DateTime.MaxValue;
BackEnd\NodePackets_Tests.cs (10)
72CriticalBuildMessageEventArgs criticalMessage = new("Subcategory", "Code", "File", 1, 2, 3, 4, "{0}", "HelpKeyword", "Sender", DateTime.Now, "arg1");
73ExtendedCriticalBuildMessageEventArgs extCriticalMessage = new("extCritMsg", "Subcategory", "Code", "File", 1, 2, 3, 4, "{0}", "HelpKeyword", "Sender", DateTime.Now, "arg1");
83BuildCanceledEventArgs buildCanceled = new("message", DateTime.UtcNow);
205DateTime.MinValue);
269new CriticalBuildMessageEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "{0}", "HelpKeyword", "Sender", DateTime.Now, "arg1"),
293new ExtendedBuildErrorEventArgs("extError", "SubCategoryForSchemaValidationErrors", "MSB4000", "file", 1, 2, 3, 4, "message", "help", "sender", DateTime.UtcNow, "arg1")
299new ExtendedBuildWarningEventArgs("extWarn", "SubCategoryForSchemaValidationErrors", "MSB4000", "file", 1, 2, 3, 4, "message", "help", "sender", DateTime.UtcNow, "arg1")
305new ExtendedBuildMessageEventArgs("extWarn", "SubCategoryForSchemaValidationErrors", "MSB4000", "file", 1, 2, 3, 4, "message", "help", "sender", MessageImportance.Normal, DateTime.UtcNow, "arg1")
311new ExtendedCustomBuildEventArgs("extCustom", "message", "help", "sender", DateTime.UtcNow, "arg1")
317new ExtendedCriticalBuildMessageEventArgs("extCritMsg", "Subcategory", "Code", "File", 1, 2, 3, 4, "{0}", "HelpKeyword", "Sender", DateTime.Now, "arg1")
BackEnd\TargetUpToDateChecker_Tests.cs (26)
534private readonly DateTime _today = DateTime.Today;
535private readonly DateTime _yesterday = DateTime.Today.AddTicks(-TimeSpan.TicksPerDay);
536private readonly DateTime _twoDaysAgo = DateTime.Today.AddTicks(-2 * TimeSpan.TicksPerDay);
541public DateTime LastWriteTime;
543public FileWriteInfo(string path, DateTime lastWriteTime)
843DateTime? input1Time,
844DateTime? input2Time,
845DateTime? output1Time,
846DateTime? output2Time,
863DateTime? input1Time,
864DateTime? input2Time,
865DateTime? output1Time,
866DateTime? output2Time,
887File.SetLastWriteTime(input1, (DateTime)input1Time);
894File.SetLastWriteTime(input2, (DateTime)input2Time);
901File.SetLastWriteTime(output1, (DateTime)output1Time);
908File.SetLastWriteTime(output2, (DateTime)output2Time);
958private static readonly DateTime Old = new DateTime(2000, 1, 1);
959private static readonly DateTime Middle = new DateTime(2001, 1, 1);
960private static readonly DateTime New = new DateTime(2002, 1, 1);
1017private void SimpleSymlinkInputCheck(DateTime symlinkWriteTime, DateTime targetWriteTime,
1018DateTime outputWriteTime, bool expectedOutOfDate)
BuildEventArgsSerialization_Tests.cs (19)
63DateTime.Parse("3/1/2017 11:11:56 AM"));
92eventTimestamp: DateTime.Parse("12/12/2015 06:11:56 PM"));
105eventTimestamp: DateTime.Parse("12/12/2015 06:11:56 PM"));
190DateTime.Parse("12/12/2015 06:11:56 PM"));
208DateTime.Parse("12/12/2015 06:11:56 PM"));
248DateTime.Now,
307DateTime.Parse("9/1/2021 12:02:07 PM"),
341DateTime.Parse("9/1/2021 12:02:07 PM"),
381DateTime.Parse("9/1/2021 12:02:07 PM"),
414DateTime.Parse("9/1/2021 12:02:07 PM"),
455DateTime.Parse("12/12/2015 06:11:56 PM"),
490DateTime.Parse("12/12/2015 06:11:56 PM"),
578eventTimestamp: withOptionalData ? DateTime.Parse("3/1/2017 11:11:56 AM") : DateTime.Now,
642DateTime.Parse("12/12/2015 06:11:56 PM"));
673DateTime.Parse("12/12/2015 06:11:56 PM"),
705DateTime.Parse("12/12/2015 06:11:56 PM"));
727var args = new TaskParameterEventArgs(TaskParameterMessageKind.TaskOutput, "ParameterName1", "PropertyName1", "ItemName1", items, true, DateTime.MinValue);
953DateTime.Parse("3/1/2017 11:11:56 AM"));
TerminalLogger_Tests.cs (7)
45private readonly DateTime _buildStartTime = new DateTime(2023, 3, 30, 16, 30, 0);
46private readonly DateTime _targetStartTime = new DateTime(2023, 3, 30, 16, 30, 1);
47private readonly DateTime _messageTime = new DateTime(2023, 3, 30, 16, 30, 2);
48private readonly DateTime _buildFinishTime = new DateTime(2023, 3, 30, 16, 30, 5);
268return new BuildMessageEventArgs(message: message, helpKeyword: keyword, senderName: null, importance: importance, eventTimestamp: DateTime.UtcNow, lineNumber: 0, columnNumber: 0, endLineNumber: 0, endColumnNumber: 0, code: code, subcategory: null, file: null)
303return new BuildErrorEventArgs(subcategory: null, code: "AA0000", file: "directory/file", lineNumber: 1, columnNumber: 2, endLineNumber: 3, endColumnNumber: 4, message: error, helpKeyword: keyword, helpLink: link, senderName: null, eventTimestamp: DateTime.UtcNow)
311return new BuildWarningEventArgs(subcategory: null, code: "AA0000", file: "directory/file", lineNumber: 1, columnNumber: 2, endLineNumber: 3, endColumnNumber: 4, message: warning, helpKeyword: keyword, helpLink: link, senderName: null, eventTimestamp: DateTime.UtcNow)
Microsoft.Build.Framework (133)
BuildErrorEventArgs.cs (4)
96: this(subcategory, code, file, lineNumber, columnNumber, endLineNumber, endColumnNumber, message, helpKeyword, senderName, DateTime.UtcNow)
125DateTime eventTimestamp)
158DateTime eventTimestamp,
193DateTime eventTimestamp,
BuildMessageEventArgs.cs (6)
71: this(message, helpKeyword, senderName, importance, DateTime.UtcNow)
88DateTime eventTimestamp)
108DateTime eventTimestamp,
163: this(subcategory, code, file, lineNumber, columnNumber, endLineNumber, endColumnNumber, message, helpKeyword, senderName, importance, DateTime.UtcNow)
195DateTime eventTimestamp)
229DateTime eventTimestamp,
BuildWarningEventArgs.cs (4)
60: this(subcategory, code, file, lineNumber, columnNumber, endLineNumber, endColumnNumber, message, helpKeyword, senderName, DateTime.UtcNow)
89DateTime eventTimestamp)
121DateTime eventTimestamp,
155DateTime eventTimestamp,
CriticalBuildMessageEventArgs.cs (3)
49: this(subcategory, code, file, lineNumber, columnNumber, endLineNumber, endColumnNumber, message, helpKeyword, senderName, DateTime.UtcNow)
79DateTime eventTimestamp)
111DateTime eventTimestamp,
ExtendedBuildErrorEventArgs.cs (3)
74string? message, string? helpKeyword, string? senderName, DateTime eventTimestamp)
94[StringSyntax(StringSyntaxAttribute.CompositeFormat)] string? message, string? helpKeyword, string? senderName, DateTime eventTimestamp, params object[]? messageArgs)
115[StringSyntax(StringSyntaxAttribute.CompositeFormat)] string? message, string? helpKeyword, string? senderName, [StringSyntax(StringSyntaxAttribute.Uri)] string? helpLink, DateTime eventTimestamp, params object[]? messageArgs)
ExtendedBuildMessageEventArgs.cs (4)
57public ExtendedBuildMessageEventArgs(string type, string? message, string? helpKeyword, string? senderName, MessageImportance importance, DateTime eventTimestamp)
70public ExtendedBuildMessageEventArgs(string type, string? message, string? helpKeyword, string? senderName, MessageImportance importance, DateTime eventTimestamp, params object[]? messageArgs)
109string? message, string? helpKeyword, string? senderName, MessageImportance importance, DateTime eventTimestamp)
130string? message, string? helpKeyword, string? senderName, MessageImportance importance, DateTime eventTimestamp, params object[]? messageArgs)
ExtendedBuildWarningEventArgs.cs (3)
74string? message, string? helpKeyword, string? senderName, DateTime eventTimestamp)
94[StringSyntax(StringSyntaxAttribute.CompositeFormat)] string? message, string? helpKeyword, string? senderName, DateTime eventTimestamp, params object[]? messageArgs)
115[StringSyntax(StringSyntaxAttribute.CompositeFormat)] string? message, string? helpKeyword, string? senderName, [StringSyntax(StringSyntaxAttribute.Uri)] string? helpLink, DateTime eventTimestamp, params object[]? messageArgs)
ExtendedCriticalBuildMessageEventArgs.cs (3)
52: this(type, subcategory, code, file, lineNumber, columnNumber, endLineNumber, endColumnNumber, message, helpKeyword, senderName, DateTime.UtcNow)
84DateTime eventTimestamp)
118DateTime eventTimestamp,
ExtendedCustomBuildEventArgs.cs (2)
58public ExtendedCustomBuildEventArgs(string type, string? message, string? helpKeyword, string? senderName, DateTime eventTimestamp) : base(message, helpKeyword, senderName, eventTimestamp) => ExtendedType = type;
69public ExtendedCustomBuildEventArgs(string type, string? message, string? helpKeyword, string? senderName, DateTime eventTimestamp, params object[]? messageArgs) : base(message, helpKeyword, senderName, eventTimestamp, messageArgs) => ExtendedType = type;
ProjectStartedEventArgs.cs (6)
61: this(message, helpKeyword, projectFile, targetNames, properties, items, DateTime.UtcNow)
86: this(projectId, message, helpKeyword, projectFile, targetNames, properties, items, parentBuildEventContext, DateTime.UtcNow)
131/// <param name="eventTimestamp">The <see cref="DateTime"/> of the event.</param>
139DateTime eventTimestamp)
160/// <param name="eventTimestamp">The <see cref="DateTime"/> of the event.</param>
170DateTime eventTimestamp)
TargetFinishedEventArgs.cs (3)
51: this(message, helpKeyword, targetName, projectFile, targetFile, succeeded, DateTime.UtcNow, null)
74: this(message, helpKeyword, targetName, projectFile, targetFile, succeeded, DateTime.UtcNow, targetOutputs)
97DateTime eventTimestamp,
TaskStartedEventArgs.cs (4)
48: this(message, helpKeyword, projectFile, taskFile, taskName, DateTime.UtcNow)
69: this(message, helpKeyword, projectFile, taskFile, taskName, DateTime.UtcNow, taskAssemblyLocation)
89DateTime eventTimestamp)
114DateTime eventTimestamp,
Microsoft.Build.Framework.UnitTests (92)
BuildErrorEventArgs_Tests.cs (5)
26beea = new BuildErrorEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "Message", "HelpKeyword", "sender", DateTime.Now);
27beea = new BuildErrorEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "{0}", "HelpKeyword", "sender", DateTime.Now, "Message");
28beea = new BuildErrorEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "{0}", "HelpKeyword", "sender", "HelpLink", DateTime.Now, "Message");
30beea = new BuildErrorEventArgs(null, null, null, 1, 2, 3, 4, null, null, null, DateTime.Now);
31beea = new BuildErrorEventArgs(null, null, null, 1, 2, 3, 4, null, null, null, null, DateTime.Now, null);
BuildMessageEventArgs_Tests.cs (8)
26bmea = new BuildMessageEventArgs("Message", "HelpKeyword", "Sender", MessageImportance.Low, DateTime.Now);
27bmea = new BuildMessageEventArgs("{0}", "HelpKeyword", "Sender", MessageImportance.Low, DateTime.Now, "Message");
29bmea = new BuildMessageEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "Message", "HelpKeyword", "Sender", MessageImportance.Low, DateTime.Now);
30bmea = new BuildMessageEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "{0}", "HelpKeyword", "Sender", MessageImportance.Low, DateTime.Now, "Message");
32bmea = new BuildMessageEventArgs(null, null, null, MessageImportance.Low, DateTime.Now);
33bmea = new BuildMessageEventArgs(null, null, null, MessageImportance.Low, DateTime.Now, null);
35bmea = new BuildMessageEventArgs(null, null, null, 0, 0, 0, 0, null, null, null, MessageImportance.Low, DateTime.Now);
36bmea = new BuildMessageEventArgs(null, null, null, 0, 0, 0, 0, null, null, null, MessageImportance.Low, DateTime.Now, null);
BuildStartedEventArgs_Tests.cs (4)
30bsea = new BuildStartedEventArgs("Message", "HelpKeyword", DateTime.Now);
31bsea = new BuildStartedEventArgs("{0}", "HelpKeyword", DateTime.Now, "Message");
33bsea = new BuildStartedEventArgs(null, null, DateTime.Now);
34bsea = new BuildStartedEventArgs(null, null, DateTime.Now, null);
BuildWarningEventArgs_Tests.cs (6)
31buildWarningEvent = new BuildWarningEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "Message", "HelpKeyword", "sender", DateTime.Now);
32buildWarningEvent = new BuildWarningEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "{0}", "HelpKeyword", "sender", DateTime.Now, "Message");
33buildWarningEvent = new BuildWarningEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "{0}", "HelpKeyword", "sender", "HelpLink", DateTime.Now, "Message");
35buildWarningEvent = new BuildWarningEventArgs(null, null, null, 1, 2, 3, 4, null, null, null, DateTime.Now);
36buildWarningEvent = new BuildWarningEventArgs(null, null, null, 1, 2, 3, 4, null, null, null, DateTime.Now, null);
37buildWarningEvent = new BuildWarningEventArgs(null, null, null, 1, 2, 3, 4, null, null, null, null, DateTime.Now, null);
CriticalBuildMessageEventArgs_Tests.cs (4)
25cbmea = new CriticalBuildMessageEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "Message", "HelpKeyword", "Sender", DateTime.Now);
26cbmea = new CriticalBuildMessageEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "{0}", "HelpKeyword", "Sender", DateTime.Now, "Message");
28cbmea = new CriticalBuildMessageEventArgs(null, null, null, 0, 0, 0, 0, null, null, null, DateTime.Now);
29cbmea = new CriticalBuildMessageEventArgs(null, null, null, 0, 0, 0, 0, null, null, null, DateTime.Now, null);
CustomEventArgSerialization_Tests.cs (7)
178genericEvent = new BuildErrorEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "Message", "HelpKeyword", "SenderName", "HelpLink", DateTime.Now);
187newGenericEvent = new BuildErrorEventArgs("Something", "SomeThing", "SomeThing", -1, -1, -1, -1, "Something", "SomeThing", "Something", "HelpLink", DateTime.Now);
488genericEvent = new BuildWarningEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "Message", "HelpKeyword", "SenderName", "HelpLink", DateTime.Now, null);
720TargetStartedEventArgs genericEvent = new TargetStartedEventArgs("Message", "HelpKeyword", "TargetName", "ProjectFile", "TargetFile", "ParentTargetStartedEvent", TargetBuiltReason.AfterTargets, DateTime.UtcNow);
738genericEvent = new TargetStartedEventArgs(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, TargetBuiltReason.AfterTargets, DateTime.Now);
756genericEvent = new TargetStartedEventArgs(null, null, null, null, null, null, TargetBuiltReason.AfterTargets, DateTime.Now);
763newGenericEvent = new TargetStartedEventArgs("Something", "Something", "Something", "Something", "Something", "Something", TargetBuiltReason.AfterTargets, DateTime.Now);
ExtendedBuildEventArgs_Tests.cs (33)
24eventTimestamp: withOptionalData ? DateTime.Parse("3/1/2017 11:11:56 AM") : DateTime.Now,
62eventTimestamp: withOptionalData ? DateTime.Parse("3/1/2017 11:11:56 AM") : DateTime.Now,
101eventTimestamp: withOptionalData ? DateTime.Parse("3/1/2017 11:11:56 AM") : DateTime.Now,
139eventTimestamp: withOptionalData ? DateTime.Parse("3/1/2017 11:11:56 AM") : DateTime.Now,
176eventTimestamp: withOptionalData ? DateTime.Parse("3/1/2017 11:11:56 AM") : DateTime.Now,
202ea = new ExtendedCustomBuildEventArgs("type", "Message {0}", "Help", "sender", DateTime.Now);
203ea = new ExtendedCustomBuildEventArgs("type", "Message {0}", "Help", "sender", DateTime.Now, "arg1");
206ea = new ExtendedCustomBuildEventArgs("type", null, null, null, default(DateTime));
207ea = new ExtendedCustomBuildEventArgs("type", null, null, null, default(DateTime), null);
215ea = new ExtendedBuildErrorEventArgs("type", "Subcategory", "Code", "File", 1, 2, 3, 4, "Message", "HelpKeyword", "sender", DateTime.Now);
216ea = new ExtendedBuildErrorEventArgs("type", "Subcategory", "Code", "File", 1, 2, 3, 4, "{0}", "HelpKeyword", "sender", DateTime.Now, "Message");
217ea = new ExtendedBuildErrorEventArgs("type", "Subcategory", "Code", "File", 1, 2, 3, 4, "{0}", "HelpKeyword", "sender", "HelpLink", DateTime.Now, "Message");
219ea = new ExtendedBuildErrorEventArgs("type", null, null, null, 1, 2, 3, 4, null, null, null, DateTime.Now);
220ea = new ExtendedBuildErrorEventArgs("type", null, null, null, 1, 2, 3, 4, null, null, null, null, DateTime.Now, null);
228ea = new ExtendedBuildWarningEventArgs("type", "Subcategory", "Code", "File", 1, 2, 3, 4, "Message", "HelpKeyword", "sender", DateTime.Now);
229ea = new ExtendedBuildWarningEventArgs("type", "Subcategory", "Code", "File", 1, 2, 3, 4, "{0}", "HelpKeyword", "sender", DateTime.Now, "Message");
230ea = new ExtendedBuildWarningEventArgs("type", "Subcategory", "Code", "File", 1, 2, 3, 4, "{0}", "HelpKeyword", "sender", "HelpLink", DateTime.Now, "Message");
232ea = new ExtendedBuildWarningEventArgs("type", null, null, null, 1, 2, 3, 4, null, null, null, DateTime.Now);
233ea = new ExtendedBuildWarningEventArgs("type", null, null, null, 1, 2, 3, 4, null, null, null, null, DateTime.Now, null);
242ea = new ExtendedBuildMessageEventArgs("type", "Message", "HelpKeyword", "sender", MessageImportance.High, DateTime.Now);
243ea = new ExtendedBuildMessageEventArgs("type", "Message", "HelpKeyword", "sender", MessageImportance.High, DateTime.Now, "arg1");
245ea = new ExtendedBuildMessageEventArgs("type", "Subcategory", "Code", "File", 1, 2, 3, 4, "Message", "HelpKeyword", "sender", MessageImportance.High, DateTime.Now);
246ea = new ExtendedBuildMessageEventArgs("type", "Subcategory", "Code", "File", 1, 2, 3, 4, "{0}", "HelpKeyword", "sender", MessageImportance.High, DateTime.Now, "Message");
249ea = new ExtendedBuildMessageEventArgs("type", null, null, null, default, DateTime.Now);
252ea = new ExtendedBuildMessageEventArgs("type", null, null, null, 1, 2, 3, 4, null, null, null, default, DateTime.Now);
253ea = new ExtendedBuildMessageEventArgs("type", null, null, null, 1, 2, 3, 4, null, null, null, default, DateTime.Now, null);
262ea = new ExtendedCriticalBuildMessageEventArgs("type", "Subcategory", "Code", "File", 1, 2, 3, 4, "Message", "HelpKeyword", "sender", DateTime.Now);
263ea = new ExtendedCriticalBuildMessageEventArgs("type", "Subcategory", "Code", "File", 1, 2, 3, 4, "{0}", "HelpKeyword", "sender", DateTime.Now, "arg1", "arg2");
ExternalProjectFinishedEventArgs_Tests.cs (2)
26externalProjectFinishedEvent = new ExternalProjectFinishedEventArgs("Message", "HelpKeyword", "Sender", "ProjectFile", true, DateTime.Now);
28externalProjectFinishedEvent = new ExternalProjectFinishedEventArgs(null, null, null, null, true, DateTime.Now);
ExternalProjectStartedEventArgs_Tests.cs (2)
26externalProjectStartedEvent = new ExternalProjectStartedEventArgs("Message", "HelpKeyword", "Sender", "ProjectFile", "TargetNames", DateTime.Now);
28externalProjectStartedEvent = new ExternalProjectStartedEventArgs(null, null, null, null, null, DateTime.Now);
ProjectStartedEventArgs_Tests.cs (4)
37projectStartedEvent = new ProjectStartedEventArgs("Message", "HelpKeyword", "ProjecFile", "TargetNames", null, null, DateTime.Now);
39projectStartedEvent = new ProjectStartedEventArgs(1, "Message", "HelpKeyword", "ProjecFile", "TargetNames", null, null, null, DateTime.Now);
41projectStartedEvent = new ProjectStartedEventArgs(null, null, null, null, null, null, DateTime.Now);
43projectStartedEvent = new ProjectStartedEventArgs(1, null, null, null, null, null, null, null, DateTime.Now);
TargetFinishedEventArgs_Tests.cs (2)
28targetFinishedEvent = new TargetFinishedEventArgs("Message", "HelpKeyword", "TargetName", "ProjectFile", "TargetFile", true, DateTime.Now, outputs);
30targetFinishedEvent = new TargetFinishedEventArgs(null, null, null, null, null, true, DateTime.Now, null);
TargetStartedEventArgs_Tests.cs (4)
26targetStartedEvent = new TargetStartedEventArgs("Message", "HelpKeyword", "TargetName", "ProjectFile", "TargetFile", "ParentTarget", DateTime.Now);
27targetStartedEvent = new TargetStartedEventArgs("Message", "HelpKeyword", "TargetName", "ProjectFile", "TargetFile", "ParentTarget", TargetBuiltReason.AfterTargets, DateTime.Now);
29targetStartedEvent = new TargetStartedEventArgs(null, null, null, null, null, null, DateTime.Now);
30targetStartedEvent = new TargetStartedEventArgs(null, null, null, null, null, null, TargetBuiltReason.AfterTargets, DateTime.Now);
TaskFinishedEventArgs_Tests.cs (2)
26targetFinishedEvent = new TaskFinishedEventArgs("Message", "HelpKeyword", "ProjectFile", "TaskFile", "TaskName", true, DateTime.Now);
28targetFinishedEvent = new TaskFinishedEventArgs(null, null, null, null, null, true, DateTime.Now);
TaskStartedEventArgs_Tests.cs (2)
27taskStartedEvent = new TaskStartedEventArgs("Message", "HelpKeyword", "ProjectFile", "TaskFile", "TaskName", DateTime.Now);
29taskStartedEvent = new TaskStartedEventArgs(null, null, null, null, null, DateTime.Now);
Microsoft.Build.Tasks.Core (75)
Microsoft.Build.Tasks.UnitTests (60)
ResourceHandling\GenerateResource_Tests.cs (22)
356File.SetLastWriteTime(resxFileInput, DateTime.Now.Subtract(TimeSpan.FromMinutes(5)));
357File.SetLastWriteTime(resourceOutput, DateTime.Now.Subtract(TimeSpan.FromMinutes(10)));
360File.GetLastAccessTime(t2.OutputResources[0].ItemSpec).ShouldBe(DateTime.Now, TimeSpan.FromSeconds(5));
419DateTime firstWriteTime = File.GetLastWriteTime(t.OutputResources[0].ItemSpec);
421File.SetLastWriteTime(bitmap, DateTime.Now + TimeSpan.FromSeconds(2));
687DateTime firstOutputCreationTime = File.GetLastWriteTime(createResources.OutputResources[0].ItemSpec);
688DateTime secondOutputCreationTime = File.GetLastWriteTime(createResources.OutputResources[1].ItemSpec);
704File.SetLastWriteTime(firstResx, DateTime.Now);
752DateTime time = File.GetLastWriteTime(t.OutputResources[0].ItemSpec);
815DateTime time = File.GetLastWriteTime(t.OutputResources[0].ItemSpec);
816DateTime time2 = File.GetLastWriteTime(t.OutputResources[1].ItemSpec);
885DateTime firstWriteTime = File.GetLastWriteTime(initialCreator.OutputResources[0].ItemSpec);
898DateTime newTime = DateTime.Now + new TimeSpan(0, 1, 0);
983DateTime newTime = DateTime.Now + new TimeSpan(0, 1, 0);
1333DateTime strTime = Utilities.MoveBackTimestamp(strFile, 1);
3695DateTime initialWriteTime = File.GetLastWriteTime(resourcesFile);
3735public static DateTime MoveBackTimestamp(string fileName, int minutes)
3737DateTime newTime = File.GetLastWriteTime(fileName) - new TimeSpan(0, minutes, 0);
3745public static bool FileUpdated(string fileName, DateTime previousWriteTime)
3920File.SetLastWriteTime(dll.Path, DateTime.Now - TimeSpan.FromDays(30));
Microsoft.Build.UnitTests.Shared (4)
Microsoft.Build.Utilities.Core (119)
TrackedDependencies\CanonicalTrackedFilesHelper.cs (7)
57internal static bool FilesExistAndRecordNewestWriteTime(ICollection<ITaskItem> files, TaskLoggingHelper log, out DateTime outputNewestTime, out string outputNewestFilename)
70internal static bool FilesExistAndRecordOldestWriteTime(ICollection<ITaskItem> files, TaskLoggingHelper log, out DateTime outputOldestTime, out string outputOldestFilename)
73private static bool FilesExistAndRecordRequestedWriteTime(ICollection<ITaskItem> files, TaskLoggingHelper log, bool getNewest, out DateTime requestedTime, out string requestedFilename)
76requestedTime = getNewest ? DateTime.MinValue : DateTime.MaxValue;
89DateTime lastWriteTime = NativeMethodsShared.GetLastWriteFileUtcTime(item.ItemSpec);
91if (lastWriteTime == DateTime.MinValue)
TrackedDependencies\CanonicalTrackedOutputFiles.cs (26)
39public Dictionary<string, Dictionary<string, DateTime>> DependencyTable { get; private set; }
85DependencyTable = new Dictionary<string, Dictionary<string, DateTime>>(StringComparer.OrdinalIgnoreCase);
138DependencyTable = (Dictionary<string, Dictionary<string, DateTime>>)cachedEntry.DependencyTable;
185if (!DependencyTable.TryGetValue(tlogEntry, out Dictionary<string, DateTime> dependencies))
187dependencies = new Dictionary<string, DateTime>(StringComparer.OrdinalIgnoreCase);
210DateTime fileModifiedTime = NativeMethodsShared.GetLastWriteFileUtcTime(tlogEntry);
250DependencyTable = new Dictionary<string, Dictionary<string, DateTime>>(StringComparer.OrdinalIgnoreCase);
280if (DependencyTable.TryGetValue(currentRoot, out Dictionary<string, DateTime> currentOutputs))
285foreach (KeyValuePair<string, Dictionary<string, DateTime>> root in DependencyTable)
478if (DependencyTable.TryGetValue(sourceKey, out Dictionary<string, DateTime> dependencies))
498Dictionary<string, DateTime> dependencies = GetSourceKeyOutputs(sourceKey);
509Dictionary<string, DateTime> dependencies = GetSourceKeyOutputs(sourceKey);
523Dictionary<string, DateTime> dependencies = GetSourceKeyOutputs(sourceKey);
535private Dictionary<string, DateTime> GetSourceKeyOutputs(string sourceKey)
537if (!DependencyTable.TryGetValue(sourceKey, out Dictionary<string, DateTime> dependencies))
539dependencies = new Dictionary<string, DateTime>(StringComparer.OrdinalIgnoreCase);
550private static void AddOutput(Dictionary<string, DateTime> dependencies, string computedOutput)
555DateTime fileModifiedTime = FileUtilities.FileExistsNoThrow(fullComputedOutput)
557: DateTime.MinValue;
597foreach (KeyValuePair<string, Dictionary<string, DateTime>> kvp in DependencyTable)
600Dictionary<string, DateTime> dependencies = kvp.Value;
685if (DependencyTable.TryGetValue(rootingMarker, out Dictionary<string, DateTime> dependencies))
753if (DependencyTable.TryGetValue(rootingMarker, out Dictionary<string, DateTime> dependencies))
755var dependenciesWithoutMissingFiles = new Dictionary<string, DateTime>(StringComparer.OrdinalIgnoreCase);
758foreach (KeyValuePair<string, DateTime> kvp in dependencies)
782dependenciesWithoutMissingFiles.Add(file, DateTime.Now);
TrackedDependencies\FlatTrackingData.cs (42)
43private DateTime _oldestFileTimeUtc = DateTime.MaxValue;
46private DateTime _newestFileTimeUtc = DateTime.MinValue;
52private DateTime _missingFileTimeUtc = DateTime.MinValue;
55private DateTime _newestTLogTimeUtc = DateTime.MinValue;
58private readonly IDictionary<string, DateTime> _lastWriteTimeUtcCache = new Dictionary<string, DateTime>(StringComparer.OrdinalIgnoreCase);
67internal Dictionary<string, DateTime> DependencyTable { get; private set; } = new Dictionary<string, DateTime>(StringComparer.OrdinalIgnoreCase);
83public DateTime OldestFileTime
92public DateTime OldestFileTimeUtc
106public DateTime NewestFileTime
115public DateTime NewestFileTimeUtc
145public DateTime NewestTLogTime
155public DateTime NewestTLogTimeUtc
180public FlatTrackingData(ITaskItem[] tlogFiles, DateTime missingFileTimeUtc) => InternalConstruct(null, tlogFiles, null, false, missingFileTimeUtc, null);
188public FlatTrackingData(ITaskItem[] tlogFiles, ITaskItem[] tlogFilesToIgnore, DateTime missingFileTimeUtc) => InternalConstruct(null, tlogFiles, tlogFilesToIgnore, false, missingFileTimeUtc, null);
198public FlatTrackingData(ITaskItem[] tlogFiles, ITaskItem[] tlogFilesToIgnore, DateTime missingFileTimeUtc, string[] excludedInputPaths, IDictionary<string, DateTime> sharedLastWriteTimeUtcCache)
217public FlatTrackingData(ITaskItem[] tlogFiles, ITaskItem[] tlogFilesToIgnore, DateTime missingFileTimeUtc, string[] excludedInputPaths, IDictionary<string, DateTime> sharedLastWriteTimeUtcCache, bool treatRootMarkersAsEntries)
235public FlatTrackingData(ITask ownerTask, ITaskItem[] tlogFiles, DateTime missingFileTimeUtc) => InternalConstruct(ownerTask, tlogFiles, null, false, missingFileTimeUtc, null);
242public FlatTrackingData(ITaskItem[] tlogFiles, bool skipMissingFiles) => InternalConstruct(null, tlogFiles, null, skipMissingFiles, DateTime.MinValue, null);
250public FlatTrackingData(ITask ownerTask, ITaskItem[] tlogFiles, bool skipMissingFiles) => InternalConstruct(ownerTask, tlogFiles, null, skipMissingFiles, DateTime.MinValue, null);
261private void InternalConstruct(ITask ownerTask, ITaskItem[] tlogFilesLocal, ITaskItem[] tlogFilesToIgnore, bool skipMissingFiles, DateTime missingFileTimeUtc, string[] excludedInputPaths)
381DependencyTable = (Dictionary<string, DateTime>)cachedEntry.DependencyTable;
409DateTime tlogLastWriteTimeUtc = NativeMethodsShared.GetLastWriteFileUtcTime(tlogFileName.ItemSpec);
484DependencyTable = new Dictionary<string, DateTime>(StringComparer.OrdinalIgnoreCase);
500_oldestFileTimeUtc = DateTime.MaxValue;
503_newestFileTimeUtc = DateTime.MinValue;
506_newestTLogTimeUtc = DateTime.MinValue;
513DateTime tlogLastWriteTimeUtc = NativeMethodsShared.GetLastWriteFileUtcTime(tlogFileName.ItemSpec);
561DateTime fileModifiedTimeUtc = GetLastWriteTimeUtc(tlogEntry);
562if (SkipMissingFiles && fileModifiedTimeUtc == DateTime.MinValue) // the file is missing
566else if (fileModifiedTimeUtc == DateTime.MinValue)
661public DateTime GetLastWriteTimeUtc(string file)
663if (!_lastWriteTimeUtcCache.TryGetValue(file, out DateTime fileModifiedTimeUtc))
690FlatTrackingData inputs = new FlatTrackingData(hostTask, readTLogNames, DateTime.MaxValue);
693FlatTrackingData outputs = new FlatTrackingData(hostTask, writeTLogNames, DateTime.MinValue);
Microsoft.Build.Utilities.UnitTests (18)
TrackedDependencies\TrackedDependenciesTests.cs (12)
3267File.SetLastWriteTime(Path.Combine("TestFiles", "one.read.tlog"), DateTime.Now);
3268File.SetLastWriteTime(Path.Combine("TestFiles", "one.write.tlog"), DateTime.Now);
3271File.SetLastWriteTime(Path.GetFullPath(Path.Combine("TestFiles", "one.obj")), DateTime.Now - TimeSpan.FromHours(1));
3360File.SetLastWriteTime(Path.GetFullPath(Path.Combine("TestFiles", "one.cpp")), DateTime.Now);
3409File.SetLastWriteTime(Path.Combine("TestFiles", "one.read.tlog"), DateTime.Now);
3410File.SetLastWriteTime(Path.Combine("TestFiles", "one.write.tlog"), DateTime.Now);
3420File.SetLastWriteTime(Path.GetFullPath(Path.Combine("TestFiles", "one.cpp")), DateTime.Now);
3457Dictionary<string, DateTime> sharedLastWriteTimeUtcCache = new Dictionary<string, DateTime>(StringComparer.OrdinalIgnoreCase);
3461DateTime.MinValue,
3465DateTime originalNewest = data.NewestFileTimeUtc;
3481DateTime.MinValue,
Microsoft.CodeAnalysis (32)
Microsoft.CodeAnalysis.Analyzers (7)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
737is nameof(DateTime)
Microsoft.CodeAnalysis.AnalyzerUtilities (7)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
737is nameof(DateTime)
Microsoft.CodeAnalysis.BannedApiAnalyzers (7)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
737is nameof(DateTime)
Microsoft.CodeAnalysis.CodeStyle (11)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
737is nameof(DateTime)
Microsoft.CodeAnalysis.CSharp (4)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (1)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (34)
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (4)
Microsoft.CodeAnalysis.CSharp.Scripting (1)
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (2)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (4)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (2)
Microsoft.CodeAnalysis.CSharp.Workspaces (1)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (2)
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (1)
Microsoft.CodeAnalysis.ExpressionEvaluator.FunctionResolver (1)
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider (1)
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.Utilities (1)
Microsoft.CodeAnalysis.Extensions.Package (2)
Microsoft.CodeAnalysis.ExternalAccess.FSharp (1)
Microsoft.CodeAnalysis.Features (12)
Microsoft.CodeAnalysis.InteractiveHost (2)
Microsoft.CodeAnalysis.LanguageServer.Protocol (2)
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (6)
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (7)
Microsoft.CodeAnalysis.PublicApiAnalyzers (7)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
737is nameof(DateTime)
Microsoft.CodeAnalysis.Remote.ServiceHub (5)
Microsoft.CodeAnalysis.ResxSourceGenerator (7)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
737is nameof(DateTime)
Microsoft.CodeAnalysis.Scripting (3)
Microsoft.CodeAnalysis.Scripting.Desktop.UnitTests (1)
Microsoft.CodeAnalysis.Test.Utilities (4)
Microsoft.CodeAnalysis.TestAnalyzerReference (1)
Microsoft.CodeAnalysis.UnitTests (8)
Microsoft.CodeAnalysis.Workspaces (44)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
737is nameof(DateTime)
Workspace\Solution\SolutionCompilationState.cs (8)
799ImmutableArray<(SourceGeneratedDocumentIdentity, DateTime, SourceText?, SyntaxNode?)>) GetOrdinaryAndSourceGeneratedDocuments()
805using var _2 = ArrayBuilder<(SourceGeneratedDocumentIdentity, DateTime, SourceText?, SyntaxNode?)>.GetInstance(out var sourceGeneratedDocuments);
814sourceGeneratedDocuments.Add((identity, DateTime.UtcNow, doc.text, null));
831ImmutableArray<(SourceGeneratedDocumentIdentity documentIdentity, DateTime generationDateTime, SourceText? sourceText, SyntaxNode? syntaxNode)> sourceGeneratedDocuments,
1004ImmutableArray<(SourceGeneratedDocumentIdentity, DateTime, SourceText?, SyntaxNode?)>) GetOrdinaryAndSourceGeneratedDocuments()
1010using var _2 = ArrayBuilder<(SourceGeneratedDocumentIdentity, DateTime, SourceText?, SyntaxNode?)>.GetInstance(out var sourceGeneratedDocuments);
1019sourceGeneratedDocuments.Add((identity, DateTime.UtcNow, null, doc.root));
1386ImmutableArray<(SourceGeneratedDocumentIdentity documentIdentity, DateTime generationDateTime, SourceText? sourceText, SyntaxNode? syntaxNode)> documents)
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (2)
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (1)
Microsoft.CodeAnalysis.Workspaces.UnitTests (10)
SolutionTests\SolutionWithSourceGeneratorTests.cs (7)
886identity, DateTime.Now, SourceText.From("// Frozen Document"));
913[(sourceGeneratedDocument1.Identity, DateTime.Now, SourceText.From("// Frozen 1")), (sourceGeneratedDocument2.Identity, DateTime.Now, SourceText.From("// Frozen 2"))]);
1274identity, DateTime.Now, SourceText.From("// Frozen Document"));
1311identity, DateTime.Now, SourceText.From("// Frozen Document"));
1342identity, DateTime.Now, SourceText.From("// Frozen Document"));
1377identity, DateTime.Now, SourceText.From("// Frozen Document"));
Microsoft.CSharp (3)
Microsoft.Data.Analysis (141)
Computations\Arithmetic.net8.cs (26)
467internal class DateTimeArithmetic : Arithmetic<DateTime>
469protected override void ElementwiseEquals(ReadOnlySpan<DateTime> x, ReadOnlySpan<DateTime> y, Span<bool> destination)
477protected override void ElementwiseEquals(ReadOnlySpan<DateTime> x, DateTime y, Span<bool> destination)
485protected override void ElementwiseNotEquals(ReadOnlySpan<DateTime> x, ReadOnlySpan<DateTime> y, Span<bool> destination)
493protected override void ElementwiseNotEquals(ReadOnlySpan<DateTime> x, DateTime y, Span<bool> destination)
501protected override void ElementwiseGreaterThanOrEqual(ReadOnlySpan<DateTime> x, ReadOnlySpan<DateTime> y, Span<bool> destination)
509protected override void ElementwiseGreaterThanOrEqual(ReadOnlySpan<DateTime> x, DateTime y, Span<bool> destination)
517protected override void ElementwiseLessThanOrEqual(ReadOnlySpan<DateTime> x, ReadOnlySpan<DateTime> y, Span<bool> destination)
525protected override void ElementwiseLessThanOrEqual(ReadOnlySpan<DateTime> x, DateTime y, Span<bool> destination)
533protected override void ElementwiseGreaterThan(ReadOnlySpan<DateTime> x, ReadOnlySpan<DateTime> y, Span<bool> destination)
541protected override void ElementwiseGreaterThan(ReadOnlySpan<DateTime> x, DateTime y, Span<bool> destination)
549protected override void ElementwiseLessThan(ReadOnlySpan<DateTime> x, ReadOnlySpan<DateTime> y, Span<bool> destination)
557protected override void ElementwiseLessThan(ReadOnlySpan<DateTime> x, DateTime y, Span<bool> destination)
728if (typeof(T) == typeof(DateTime))
DateTimeComputation.cs (59)
13internal class DateTimeComputation : IPrimitiveColumnComputation<DateTime>
15public void Abs(PrimitiveColumnContainer<DateTime> column)
20public void All(PrimitiveColumnContainer<DateTime> column, out bool ret)
25public void Any(PrimitiveColumnContainer<DateTime> column, out bool ret)
30public void CumulativeMax(PrimitiveColumnContainer<DateTime> column)
32var ret = column.Buffers[0].ReadOnlySpan[0];
36var mutableBuffer = DataFrameBuffer<DateTime>.GetMutableBuffer(buffer);
41var val = readOnlySpan[i];
54public void CumulativeMax(PrimitiveColumnContainer<DateTime> column, IEnumerable<long> rows)
56var ret = default(DateTime);
57var mutableBuffer = DataFrameBuffer<DateTime>.GetMutableBuffer(column.Buffers[0]);
60long maxRange = ReadOnlyDataFrameBuffer<DateTime>.MaxCapacity;
69mutableBuffer = DataFrameBuffer<DateTime>.GetMutableBuffer(column.Buffers[bufferIndex]);
84mutableBuffer = DataFrameBuffer<DateTime>.GetMutableBuffer(column.Buffers[bufferIndex]);
91var val = span[(int)row];
102public void CumulativeMin(PrimitiveColumnContainer<DateTime> column)
104var ret = column.Buffers[0].ReadOnlySpan[0];
108var mutableBuffer = DataFrameBuffer<DateTime>.GetMutableBuffer(buffer);
113var val = readOnlySpan[i];
126public void CumulativeMin(PrimitiveColumnContainer<DateTime> column, IEnumerable<long> rows)
128var ret = default(DateTime);
129var mutableBuffer = DataFrameBuffer<DateTime>.GetMutableBuffer(column.Buffers[0]);
132long maxRange = ReadOnlyDataFrameBuffer<DateTime>.MaxCapacity;
141mutableBuffer = DataFrameBuffer<DateTime>.GetMutableBuffer(column.Buffers[bufferIndex]);
156mutableBuffer = DataFrameBuffer<DateTime>.GetMutableBuffer(column.Buffers[bufferIndex]);
163var val = span[(int)row];
174public void CumulativeProduct(PrimitiveColumnContainer<DateTime> column)
179public void CumulativeProduct(PrimitiveColumnContainer<DateTime> column, IEnumerable<long> rows)
184public void CumulativeSum(PrimitiveColumnContainer<DateTime> column)
189public void CumulativeSum(PrimitiveColumnContainer<DateTime> column, IEnumerable<long> rows)
194public void Max(PrimitiveColumnContainer<DateTime> column, out DateTime? ret)
196var maxDate = DateTime.MinValue;
209var val = readOnlySpan[i];
222public void Max(PrimitiveColumnContainer<DateTime> column, IEnumerable<long> rows, out DateTime? ret)
227long maxRange = ReadOnlyDataFrameBuffer<DateTime>.MaxCapacity;
242var val = readOnlySpan[(int)row];
251public void Min(PrimitiveColumnContainer<DateTime> column, out DateTime? ret)
253var minDate = DateTime.MaxValue;
267var val = readOnlySpan[i];
280public void Min(PrimitiveColumnContainer<DateTime> column, IEnumerable<long> rows, out DateTime? ret)
285long maxRange = ReadOnlyDataFrameBuffer<DateTime>.MaxCapacity;
300var val = readOnlySpan[(int)row];
309public void Product(PrimitiveColumnContainer<DateTime> column, out DateTime? ret)
314public void Product(PrimitiveColumnContainer<DateTime> column, IEnumerable<long> rows, out DateTime? ret)
319public void Sum(PrimitiveColumnContainer<DateTime> column, out DateTime? ret)
324public void Sum(PrimitiveColumnContainer<DateTime> column, IEnumerable<long> rows, out DateTime? ret)
329public void Round(PrimitiveColumnContainer<DateTime> column)
Microsoft.Data.Analysis.Interactive (1)
Microsoft.Data.Analysis.Tests (31)
DataFrame.IOTests.cs (21)
113else if (dataType == typeof(DateTime))
526Assert.True(typeof(DateTime) == df.Columns[7].DataType);
568DataFrame df = DataFrame.LoadCsv(GetStream(data), dataTypes: new Type[] { typeof(string), typeof(short), typeof(int), typeof(long), typeof(float), typeof(string), typeof(double), typeof(DateTime) });
570df = DataFrame.LoadCsvFromString(data, dataTypes: new Type[] { typeof(string), typeof(short), typeof(int), typeof(long), typeof(float), typeof(string), typeof(double), typeof(DateTime) });
1089dateColumn[0] = DateTime.Today;
1090dateColumn[1] = DateTime.Today.AddDays(1);
1118dateColumn[0] = DateTime.Today;
1119dateColumn[1] = DateTime.Today.AddDays(1);
1120dateColumn[2] = DateTime.Today.AddDays(2);
1615new Type[] { typeof(string), typeof(float), typeof(string), typeof(DateTime), typeof(float), typeof(float), typeof(string) },
1618new object[] { "Paul", 34f, "Paul lives in Vermont, VA.", DateTime.Parse("2024-01-23T05:06:15.028"), 195.48f, 123f, null },
1619new object[] { "Victor", 29f, "Victor: Funny guy", DateTime.Parse("2023-11-04T17:27:59.167"), 175.3f, 2147483648f, null },
1622new object[] { "Maria", 31f, "", DateTime.Parse("2024-03-31T07:20:47.250"), 126f, 456f, null }
1630new Type[] { typeof(string), typeof(int), typeof(string), typeof(DateTime), typeof(double), typeof(long), typeof(string) },
1633new object[] { "Paul", 34, "Paul lives in Vermont, VA.", DateTime.Parse("2024-01-23T05:06:15.028"), 195.48, 123L, null },
1634new object[] { "Victor", 29, "Victor: Funny guy", DateTime.Parse("2023-11-04T17:27:59.167"), 175.3, 2147483648L, null },
1637new object[] { "Maria", 31, "", DateTime.Parse("2024-03-31T07:20:47.250"), 126.0, 456L, null }
1648typeof(DateTime)
1698else if (type == typeof(DateTime))
1700if (!DateTime.TryParse(item, out DateTime result))
Microsoft.DotNet.ApiCompat.Task (1)
Microsoft.DotNet.ApiSymbolExtensions (1)
Microsoft.DotNet.Arcade.Sdk (6)
Microsoft.DotNet.ArcadeAzureIntegration (4)
Microsoft.DotNet.Baselines.Tasks (5)
Microsoft.DotNet.Build.Tasks.Feed.Tests (10)
Microsoft.DotNet.Build.Tasks.Installers (12)
src\GenerateCurrentVersion.cs (8)
73DateTime date;
75if (!(DateTime.TryParseExact(SeedDate, DateFormat, enUS, DateTimeStyles.AssumeLocal, out date)))
78if (!(DateTime.TryParseExact(SeedDate, LastModifiedTimeDateFormat, enUS, DateTimeStyles.AssumeLocal, out date)))
102DateTime buildIdDate;
103if (!DateTime.TryParseExact(match.Groups[1].Value, dateFormat, enUS, DateTimeStyles.AssumeLocal, out buildIdDate))
117public string GetCurrentVersionForDate(DateTime seedDate, string comparisonDate)
119DateTime compareDate;
130bool isValidDate = DateTime.TryParseExact(comparisonDate, DateFormat, enUS, DateTimeStyles.AssumeLocal, out compareDate);
Microsoft.DotNet.Build.Tasks.Packaging.Tests (1)
Microsoft.DotNet.Build.Tasks.VisualStudio (3)
Microsoft.DotNet.Git.IssueManager (1)
Microsoft.DotNet.Helix.JobSender (13)
Microsoft.DotNet.Internal.SymbolHelper (5)
Microsoft.DotNet.MSBuildSdkResolver.Tests (2)
Microsoft.DotNet.Open.Api.Tools.Tests (6)
Microsoft.DotNet.RemoteExecutor (1)
Microsoft.DotNet.SignCheckLibrary (33)
Utils.cs (8)
89public static DateTime DateTimeOrDefault(this string timestamp, DateTime defaultValue)
105if (DateTime.TryParse(timestamp, out DateTime dateTime))
246private static bool TryParseCodeSignTimestamp(string timestamp, out DateTime dateTime)
256if (DateTime.TryParseExact(normalizedTimestamp, codesignFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime))
267private static bool TryParseOpensslTimestamp(string timestamp, out DateTime dateTime)
283if (DateTime.TryParseExact(normalizedTimestamp, opensslFormat, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal, out dateTime))
Microsoft.DotNet.SignCheckTask (4)
Microsoft.DotNet.SourceBuild.Tasks (5)
Microsoft.DotNet.XUnitAssert.Tests (19)
EqualityAssertsTests.cs (8)
1727 var expected = new DateTime(2023, 2, 11, 15, 4, 0);
1728 var actual = new DateTime(2023, 2, 11, 15, 4, 0);
1740 var expected = new DateTime(2023, 2, 11, 15, 4, 0);
1741 var actual = new DateTime(2023, 2, 11, 15, 5, 0);
1760 var date1 = new DateTime(2023, 2, 11, 15, 4, 0);
1761 var date2 = new DateTime(2023, 2, 11, 15, 5, 0);
1775 var date1 = new DateTime(2023, 2, 11, 15, 4, 0);
1776 var date2 = new DateTime(2023, 2, 11, 15, 6, 0);
EquivalenceAssertsTests.cs (6)
1448 var expected = new DateTime(2022, 12, 1, 1, 3, 1);
1449 var actual = new DateTime(2022, 12, 1, 1, 3, 1);
1457 var expected = new DateTime(2022, 12, 1, 1, 3, 1);
1458 var actual = new DateTime(2011, 9, 13, 18, 22, 0);
1474 var expected = new DateTime(2022, 12, 1, 1, 3, 1);
1493 var actual = new DateTime(2022, 12, 1, 1, 3, 1);
Sdk\ArgumentFormatterTests.cs (5)
166 var now = DateTime.UtcNow;
208 { typeof(DateTime[,]), "typeof(System.DateTime[,])" },
213 { typeof(IDictionary<string, DateTime>), "typeof(System.Collections.Generic.IDictionary<string, DateTime>)" },
214 { typeof(IDictionary<string[,], DateTime[,][]>), "typeof(System.Collections.Generic.IDictionary<string[,], DateTime[,][]>)" },
Microsoft.Extensions.AI.Abstractions (2)
Microsoft.Extensions.AI.Abstractions.Tests (7)
Microsoft.Extensions.AI.Evaluation.Integration.Tests (8)
Microsoft.Extensions.AI.Evaluation.Reporting (20)
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (12)
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (26)
Microsoft.Extensions.AI.Integration.Tests (1)
Microsoft.Extensions.AI.Tests (8)
Microsoft.Extensions.Caching.Hybrid.Tests (1)
Microsoft.Extensions.Caching.Memory (17)
Microsoft.Extensions.Caching.StackExchangeRedis.Tests (6)
Microsoft.Extensions.Compliance.Abstractions.Tests (1)
Microsoft.Extensions.Diagnostics.Testing.Tests (1)
Microsoft.Extensions.FileProviders.Physical (18)
Microsoft.Extensions.Http.Resilience.Tests (2)
Microsoft.Extensions.Options.Contextual.Tests (1)
Microsoft.Extensions.ServiceDiscovery.Dns (26)
Resolver\DnsResolver.cs (12)
121res[index] = new AddressResult(DateTime.MaxValue, IPAddress.IPv6Loopback);
126res[index] = new AddressResult(DateTime.MaxValue, IPAddress.Loopback);
159return ValueTask.FromResult<AddressResult[]>([new AddressResult(DateTime.MaxValue, IPAddress.Loopback)]);
163return ValueTask.FromResult<AddressResult[]>([new AddressResult(DateTime.MaxValue, IPAddress.IPv6Loopback)]);
501DateTime queryStartedTime = _timeProvider.GetUtcNow().DateTime;
568DateTime expirationTime =
606internal static bool GetNegativeCacheExpiration(DateTime createdAt, List<DnsResourceRecord> authorities, out DateTime expiration)
633internal static SendQueryError ValidateResponse(QueryResponseCode responseCode, DateTime createdAt, List<DnsResourceRecord> answers, List<DnsResourceRecord> authorities, ref DateTime expiration)
656if (!authorities.Any(r => r.Type == QueryType.NS) && GetNegativeCacheExpiration(createdAt, authorities, out DateTime newExpiration))
674if (GetNegativeCacheExpiration(createdAt, authorities, out DateTime newExpiration))
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (10)
DnsSrvServiceEndpointResolverTests.cs (10)
44new ServiceResult(DateTime.UtcNow.AddSeconds(60), 99, 66, 8888, "srv-a", [new AddressResult(DateTime.UtcNow.AddSeconds(64), IPAddress.Parse("10.10.10.10"))]),
45new ServiceResult(DateTime.UtcNow.AddSeconds(60), 99, 62, 9999, "srv-b", [new AddressResult(DateTime.UtcNow.AddSeconds(64), IPAddress.IPv6Loopback)]),
46new ServiceResult(DateTime.UtcNow.AddSeconds(60), 99, 62, 7777, "srv-c", [])
95new ServiceResult(DateTime.UtcNow.AddSeconds(60), 99, 66, 8888, "srv-a", [new AddressResult(DateTime.UtcNow.AddSeconds(64), IPAddress.Parse("10.10.10.10"))]),
96new ServiceResult(DateTime.UtcNow.AddSeconds(60), 99, 62, 9999, "srv-b", [new AddressResult(DateTime.UtcNow.AddSeconds(64), IPAddress.IPv6Loopback)]),
97new ServiceResult(DateTime.UtcNow.AddSeconds(60), 99, 62, 7777, "srv-c", [])
Microsoft.Extensions.ServiceDiscovery.Yarp.Tests (6)
YarpServiceDiscoveryTests.cs (6)
277new ServiceResult(DateTime.UtcNow.AddSeconds(60), 99, 66, 8888, "srv-a", [new AddressResult(DateTime.UtcNow.AddSeconds(64), IPAddress.Parse("10.10.10.10"))]),
278new ServiceResult(DateTime.UtcNow.AddSeconds(60), 99, 62, 9999, "srv-b", [new AddressResult(DateTime.UtcNow.AddSeconds(64), IPAddress.IPv6Loopback)]),
279new ServiceResult(DateTime.UtcNow.AddSeconds(60), 99, 62, 7777, "srv-c", [new AddressResult(DateTime.UtcNow.AddSeconds(64), IPAddress.Loopback)])
Microsoft.Extensions.Telemetry.Abstractions (2)
Microsoft.Extensions.Telemetry.Abstractions.Tests (3)
Microsoft.Extensions.Validation (1)
Microsoft.Extensions.Validation.Tests (6)
Microsoft.Gen.Logging.Generated.Tests (16)
LogPropertiesTests.cs (4)
90P0 = DateTime.Now,
211SetOnlyProperty = DateTime.MinValue,
319var now = new DateTime(2024, 1, 1, 0, 0, 0, DateTimeKind.Utc);
339var now = new DateTime(2024, 1, 1, 0, 0, 0, DateTimeKind.Utc);
Microsoft.Gen.Logging.Unit.Tests (1)
Microsoft.Maui (4)
Microsoft.Maui.Controls (30)
DatePicker\DatePicker.cs (22)
17 public static readonly BindableProperty DateProperty = BindableProperty.Create(nameof(Date), typeof(DateTime), typeof(DatePicker), default(DateTime), BindingMode.TwoWay,
20 defaultValueCreator: (bindable) => DateTime.Today);
23 public static readonly BindableProperty MinimumDateProperty = BindableProperty.Create(nameof(MinimumDate), typeof(DateTime), typeof(DatePicker), new DateTime(1900, 1, 1),
27 public static readonly BindableProperty MaximumDateProperty = BindableProperty.Create(nameof(MaximumDate), typeof(DateTime), typeof(DatePicker), new DateTime(2100, 12, 31),
57 public DateTime Date
59 get { return (DateTime)GetValue(DateProperty); }
77 public DateTime MaximumDate
79 get { return (DateTime)GetValue(MaximumDateProperty); }
84 public DateTime MinimumDate
86 get { return (DateTime)GetValue(MinimumDateProperty); }
166 DateTime dateValue = ((DateTime)value).Date;
179 DateTime dateValue = ((DateTime)value).Date;
189 DateTime dateValue = ((DateTime)value).Date;
203 selected(datePicker, new DateChangedEventArgs((DateTime)oldValue, (DateTime)newValue));
208 return ((DateTime)value).Date >= ((DatePicker)bindable).MinimumDate.Date;
213 return ((DateTime)value).Date <= ((DatePicker)bindable).MaximumDate.Date;
233 DateTime IDatePicker.Date
Microsoft.Maui.Controls.Build.Tasks (2)
Microsoft.Maui.Essentials (13)
Preferences\Preferences.shared.cs (9)
226 public static DateTime Get(string key, DateTime defaultValue) =>
230 public static void Set(string key, DateTime value) =>
242 public static DateTime Get(string key, DateTime defaultValue, string? sharedName) =>
243 Current.Get<DateTime>(key, defaultValue, sharedName);
246 public static void Set(string key, DateTime value, string? sharedName) =>
247 Current.Set<DateTime>(key, value, sharedName);
281 typeof(DateTime),
Microsoft.Maui.Resizetizer (4)
Microsoft.ML.AutoML (5)
Microsoft.ML.AutoML.Interactive (5)
Microsoft.ML.Core (19)
Microsoft.ML.Core.Tests (6)
Microsoft.ML.Data (59)
Data\Conversion.cs (23)
18using DT = DateTime;
237AddStd<TX, DT>(Convert);
256AddStd<DT, I8>(Convert);
257AddStd<DT, R4>(Convert);
258AddStd<DT, R8>(Convert);
259AddStd<DT, DT>(Convert);
260AddAux<DT, SB>(Convert);
261AddStd<DT, TX>(Convert);
292AddIsDef<DT>(IsDefault);
314AddTryParse<DT>(TryParse);
790private bool IsDefault(in DT src) => src.Equals(default(DT));
834public void Convert(in DT src, ref I8 dst) => dst = (I8)src.Ticks;
892public void Convert(in DT src, ref R4 dst) => dst = (R4)src.Ticks;
910public void Convert(in DT src, ref R8 dst) => dst = (R8)src.Ticks;
935public void Convert(in DT src, ref SB dst) { ClearDst(ref dst); dst.AppendFormat("{0:o}", src); }
953public void Convert(in DT src, ref TX dst) => dst = string.Format("{0:o}", src).AsMemory();
1418public bool TryParse(in TX src, out DT dst)
1426if (DateTime.TryParse(src.ToString(), CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal, out dst))
1716public void Convert(in TX span, ref DT value) => TryParse(in span, out value);
1732public void Convert(in DT src, ref DT dst) => dst = src;
Transforms\ConversionsExtensionsCatalog.cs (15)
74/// This transform operates over numeric, boolean, text, <see cref="System.DateTime"/> and key data types.</param>
92/// This transform operates over numeric, boolean, text, <see cref="System.DateTime"/> and key data types.</param>
117/// This transform operates over numeric, boolean, text, <see cref="System.DateTime"/> and keys.</param>
228/// The input data types can be numeric, text, boolean, <see cref="System.DateTime"/> or <see cref="System.DateTimeOffset"/>.
263/// The input data types can be numeric, text, boolean, <see cref="System.DateTime"/> or <see cref="System.DateTimeOffset"/>.
301/// The input data types can be numeric, text, boolean, <see cref="System.DateTime"/> or <see cref="System.DateTimeOffset"/>.
318/// The output data types can be primitives or vectors of numeric, text, boolean, <see cref="System.DateTime"/>, <see cref="System.DateTimeOffset"/> or <see cref="DataViewRowId"/> types.</param>
322/// The input data types can be primitives or vectors of numeric, text, boolean, <see cref="System.DateTime"/>, <see cref="System.DateTimeOffset"/> or <see cref="DataViewRowId"/> types.
361/// The data types can be primitives or vectors of numeric, text, boolean, <see cref="System.DateTime"/>, <see cref="System.DateTimeOffset"/> or <see cref="DataViewRowId"/> types.
394/// The data types can be primitives or vectors of numeric, text, boolean, <see cref="System.DateTime"/>, <see cref="System.DateTimeOffset"/> or <see cref="DataViewRowId"/> types.
425/// The data types can be primitives or vectors of numeric, text, boolean, <see cref="System.DateTime"/>, <see cref="System.DateTimeOffset"/> or <see cref="DataViewRowId"/> types,
429/// The data types can be primitives or vectors of numeric, text, boolean, <see cref="System.DateTime"/>, <see cref="System.DateTimeOffset"/> or <see cref="DataViewRowId"/> types,
465/// <param name="columns">The input and output columns. The data types can be primitives or vectors of numeric, text, boolean, <see cref="System.DateTime"/>,
494/// The data types can be primitives or vectors of numeric, text, boolean, <see cref="System.DateTime"/>, <see cref="System.DateTimeOffset"/>
500/// The data types can be primitives or vectors of numeric, text, boolean, <see cref="System.DateTime"/>, <see cref="System.DateTimeOffset"/>
Microsoft.ML.DataView (2)
Microsoft.ML.Fairlearn (1)
Microsoft.ML.FastTree (1)
Microsoft.ML.GenAI.Core (2)
Microsoft.ML.IntegrationTests (2)
Microsoft.ML.Maml (1)
Microsoft.ML.ResultProcessor (1)
Microsoft.ML.Samples (21)
Dynamic\Transforms\Conversion\ConvertTypeMultiColumn.cs (6)
21Feature3 = DateTime.Now, Feature4 = 0.145},
24Feature3 = DateTime.Today, Feature4 = 3.14},
27Feature3 = DateTime.Today, Feature4 = 0.2046},
30Feature3 = DateTime.Now, Feature4 = 0.1206},
33Feature3 = DateTime.UtcNow, Feature4 = 8.09},
82public DateTime Feature3;
Microsoft.ML.StandardTrainers (3)
Microsoft.ML.TestFramework (4)
Microsoft.ML.Tests (9)
Microsoft.ML.TimeSeries (5)
RootCauseLocalizationType.cs (5)
39public DateTime AnomalyTimestamp { get; set; }
61public RootCauseLocalizationInput(DateTime anomalyTimestamp, Dictionary<string, Object> anomalyDimension, List<MetricSlice> slices, AggregateType aggregateType, Object aggregateSymbol)
70public RootCauseLocalizationInput(DateTime anomalyTimestamp, Dictionary<string, Object> anomalyDimension, List<MetricSlice> slices, Object aggregateSymbol)
174public DateTime TimeStamp { get; set; }
180public MetricSlice(DateTime timeStamp, List<TimeSeriesPoint> points)
Microsoft.ML.TimeSeries.Tests (1)
Microsoft.ML.Transforms (2)
Microsoft.NET.Build.Containers.IntegrationTests (15)
FullFramework\CreateNewImageToolTaskTests.cs (15)
28DirectoryInfo publishDir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), DateTime.Now.ToString("yyyyMMddHHmmssfff")));
71DirectoryInfo publishDir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), DateTime.Now.ToString("yyyyMMddHHmmssfff")));
105DirectoryInfo publishDir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), DateTime.Now.ToString("yyyyMMddHHmmssfff")));
138DirectoryInfo publishDir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), DateTime.Now.ToString("yyyyMMddHHmmssfff")));
170DirectoryInfo publishDir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), DateTime.Now.ToString("yyyyMMddHHmmssfff")));
206DirectoryInfo publishDir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), DateTime.Now.ToString("yyyyMMddHHmmssfff")));
252DirectoryInfo publishDir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), DateTime.Now.ToString("yyyyMMddHHmmssfff")));
303DirectoryInfo publishDir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), DateTime.Now.ToString("yyyyMMddHHmmssfff")));
393DirectoryInfo publishDir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), DateTime.Now.ToString("yyyyMMddHHmmssfff")));
412DirectoryInfo publishDir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), DateTime.Now.ToString("yyyyMMddHHmmssfff")));
447DirectoryInfo publishDir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), DateTime.Now.ToString("yyyyMMddHHmmssfff")));
484DirectoryInfo publishDir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), DateTime.Now.ToString("yyyyMMddHHmmssfff")));
522DirectoryInfo publishDir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), DateTime.Now.ToString("yyyyMMddHHmmssfff")));
548DirectoryInfo publishDir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), DateTime.Now.ToString("yyyyMMddHHmmssfff")));
579DirectoryInfo publishDir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), DateTime.Now.ToString("yyyyMMddHHmmssfff")));
Microsoft.NET.Build.Extensions.Tasks (2)
Microsoft.NET.Build.Tasks (2)
Microsoft.NET.Build.Tests (19)
Microsoft.Net.Http.Headers.Tests (1)
Microsoft.NET.Publish.Tests (11)
Microsoft.NET.Sdk.Publish.Tasks (2)
Microsoft.NET.Sdk.Razor.Tool.Tests (4)
Microsoft.NET.Sdk.StaticWebAssets.Tasks (3)
Microsoft.NET.Sdk.StaticWebAssets.Tests (52)
ComputeStaticWebAssetsTargetPathsTest.cs (4)
26var lastWrite = new DateTime(1990, 11, 15, 0, 0, 0, 0, DateTimeKind.Utc);
54var lastWrite = new DateTime(1990, 11, 15, 0, 0, 0, 0, DateTimeKind.Utc);
82var lastWrite = new DateTime(1990, 11, 15, 0, 0, 0, 0, DateTimeKind.Utc);
132LastWriteTime = DateTime.UtcNow,
StaticWebAssets\DefineStaticWebAssetEndpointsTest.cs (7)
30var lastWrite = new DateTime(1990, 11, 15, 0, 0, 0, 0, DateTimeKind.Utc);
97var lastWrite = new DateTime(1990, 11, 15, 0, 0, 0, 0, DateTimeKind.Utc);
214var lastWrite = new DateTime(1990, 11, 15, 0, 0, 0, 0, DateTimeKind.Utc);
331var lastWrite = new DateTime(1990, 11, 15, 0, 0, 0, 0, DateTimeKind.Utc);
388var lastWrite = new DateTime(1990, 11, 15, 0, 0, 0, 0, DateTimeKind.Utc);
441var lastWrite = new DateTime(1990, 11, 15, 0, 0, 0, 0, DateTimeKind.Utc);
492var lastWrite = new DateTime(1990, 11, 15, 0, 0, 0, 0, DateTimeKind.Utc);
Microsoft.NET.TestFramework (7)
Microsoft.NET.ToolPack.Tests (2)
Microsoft.VisualBasic.Core (45)
Microsoft\VisualBasic\DateAndTime.vb (31)
20Public Property Today() As DateTime
22Return DateTime.Today
25Set(ByVal Value As DateTime)
30Public ReadOnly Property Now As DateTime
32Return DateTime.Now
36Public Property TimeOfDay() As DateTime
38Dim Ticks As Int64 = DateTime.Now.TimeOfDay.Ticks
44Set(ByVal Value As DateTime)
53Return (New DateTime(DateTime.Now.TimeOfDay.Ticks)).ToString("HH:mm:ss", GetInvariantCultureInfo())
95Return DateTime.Today.ToString("yyyy\-MM\-dd", GetInvariantCultureInfo())
97Return DateTime.Today.ToString("MM\-dd\-yyyy", GetInvariantCultureInfo())
107NewDate = DateTime.ParseExact(TmpValue, AcceptedDateFormatsDBCS, GetInvariantCultureInfo(), DateTimeStyles.AllowWhiteSpaces)
109NewDate = DateTime.ParseExact(TmpValue, AcceptedDateFormatsSBCS, GetInvariantCultureInfo(), DateTimeStyles.AllowWhiteSpaces)
143ByVal DateValue As DateTime) As DateTime
173ByVal Date1 As DateTime,
174ByVal Date2 As DateTime,
227Public Function DatePart(ByVal Interval As DateInterval, ByVal DateValue As DateTime,
280ByVal DateValue As Object) As DateTime
380Public Function DateSerial(ByVal [Year] As Integer, ByVal [Month] As Integer, ByVal [Day] As Integer) As DateTime
384Dim Result As DateTime
439Public Function TimeSerial(ByVal Hour As Integer, ByVal Minute As Integer, ByVal Second As Integer) As DateTime
452Public Function DateValue(ByVal [StringDate] As String) As DateTime
458Public Function TimeValue(ByVal [StringTime] As String) As DateTime
467Public Function Year(ByVal DateValue As DateTime) As Integer
471Public Function Month(ByVal DateValue As DateTime) As Integer
475Public Function Day(ByVal DateValue As DateTime) As Integer
479Public Function Hour(ByVal [TimeValue] As DateTime) As Integer
483Public Function Minute(ByVal [TimeValue] As DateTime) As Integer
487Public Function Second(ByVal [TimeValue] As DateTime) As Integer
491Public Function Weekday(ByVal DateValue As DateTime, Optional ByVal DayOfWeek As FirstDayOfWeek = FirstDayOfWeek.Sunday) As Integer
Microsoft.VisualBasic.Tests (9)
Microsoft.VisualStudio.LanguageServices (19)
Microsoft.WebTools.AspireService.Package (4)
Microsoft.WebTools.AspireService.Tests (6)
MinimalFormSample (4)
MinimalSampleOwin (1)
MSBuild (31)
MSBuildTaskHost (45)
mscorlib (1)
Mvc.Api.Analyzers.Test (1)
MvcFormSample (2)
MyFrontend (9)
artifacts\obj\MyFrontend\Debug\net8.0\BasketGrpc.cs (8)
129public virtual global::GrpcBasket.CustomerBasketResponse GetBasketById(global::GrpcBasket.BasketRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
139public virtual grpc::AsyncUnaryCall<global::GrpcBasket.CustomerBasketResponse> GetBasketByIdAsync(global::GrpcBasket.BasketRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
149public virtual global::GrpcBasket.CustomerBasketResponse UpdateBasket(global::GrpcBasket.CustomerBasketRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
159public virtual grpc::AsyncUnaryCall<global::GrpcBasket.CustomerBasketResponse> UpdateBasketAsync(global::GrpcBasket.CustomerBasketRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
169public virtual global::GrpcBasket.CheckoutCustomerBasketResponse CheckoutBasket(global::GrpcBasket.CheckoutCustomerBasketRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
179public virtual grpc::AsyncUnaryCall<global::GrpcBasket.CheckoutCustomerBasketResponse> CheckoutBasketAsync(global::GrpcBasket.CheckoutCustomerBasketRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
189public virtual global::GrpcBasket.DeleteCustomerBasketResponse DeleteBasket(global::GrpcBasket.DeleteCustomerBasketRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
199public virtual grpc::AsyncUnaryCall<global::GrpcBasket.DeleteCustomerBasketResponse> DeleteBasketAsync(global::GrpcBasket.DeleteCustomerBasketRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
netstandard (1)
OrderProcessor (1)
OutputCachingSample (2)
PresentationBuildTasks (13)
PresentationCore (114)
PresentationCore.Tests (2)
PresentationFramework (397)
System\Windows\Automation\Peers\CalendarAutomationPeer.cs (21)
131DateTime date;
148if (owningButton != null && owningButton.DataContext is DateTime)
150date = (DateTime)owningButton.DataContext;
181DateTime focusedDate;
211private DateTimeAutomationPeer GetOrCreateDateTimeAutomationPeer(DateTime date, CalendarMode buttonMode)
216private DateTimeAutomationPeer GetOrCreateDateTimeAutomationPeer(DateTime date, CalendarMode buttonMode, bool addParentInfo)
291DateTimeAutomationPeer peer = GetOrCreateDateTimeAutomationPeer((DateTime)e.AddedItems[0], CalendarMode.Month);
298foreach (DateTime date in e.AddedItems)
308foreach (DateTime date in e.RemovedItems)
371if (dataContext is DateTime date)
458foreach (DateTime date in OwningCalendar.SelectedDates)
490DateTime? nextDate = null;
502DateTime parsedDate;
503if (DateTime.TryParse((value as string), format, System.Globalization.DateTimeStyles.None, out parsedDate))
542private DateTime? GetNextDate(DateTimeAutomationPeer currentDatePeer, CalendarMode currentMode)
544DateTime? nextDate = null;
546DateTime startDate = (currentDatePeer != null) ? currentDatePeer.Date : OwningCalendar.DisplayDate;
558private DateTime? GetNextSelectedDate(DateTimeAutomationPeer currentDatePeer, bool isSelected)
560DateTime startDate = (currentDatePeer != null) ? currentDatePeer.Date : OwningCalendar.DisplayDate;
663internal DateTimeCalendarModePair(DateTime date, CalendarMode mode)
670private DateTime Date;
System\Windows\Controls\Calendar.cs (92)
33private DateTime? _hoverStart;
34private DateTime? _hoverEnd;
36private DateTime? _currentDate;
95this.SetCurrentValueInternal(DisplayDateProperty, DateTime.Today);
184public DateTime DisplayDate
186get { return (DateTime)GetValue(DisplayDateProperty); }
196typeof(DateTime),
198new FrameworkPropertyMetadata(DateTime.MinValue, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnDisplayDateChanged, CoerceDisplayDate));
210c.DisplayDateInternal = DateTimeHelper.DiscardDayTime((DateTime)e.NewValue);
212c.OnDisplayDateChanged(new CalendarDateChangedEventArgs((DateTime)e.OldValue, (DateTime)e.NewValue));
219DateTime date = (DateTime)value;
240public DateTime? DisplayDateEnd
242get { return (DateTime?)GetValue(DisplayDateEndProperty); }
252typeof(DateTime?),
274DateTime? date = (DateTime?)value;
283DateTime? maxSelectedDate = c.SelectedDates.MaximumDate;
301public DateTime? DisplayDateStart
303get { return (DateTime?)GetValue(DisplayDateStartProperty); }
313typeof(DateTime?),
336DateTime? date = (DateTime?)value;
340DateTime? minSelectedDate = c.SelectedDates.MinimumDate;
488int i = DateTimeHelper.CompareYearMonth(c.DisplayDateInternal, DateTime.Today);
516public DateTime? SelectedDate
518get { return (DateTime?)GetValue(SelectedDateProperty); }
528typeof(DateTime?),
544DateTime? addedDate;
546addedDate = (DateTime?)e.NewValue;
657internal DateTime DisplayDateInternal
663internal DateTime DisplayDateEndInternal
667return this.DisplayDateEnd.GetValueOrDefault(DateTime.MaxValue);
671internal DateTime DisplayDateStartInternal
675return this.DisplayDateStart.GetValueOrDefault(DateTime.MinValue);
679internal DateTime CurrentDate
685internal DateTime? HoverStart
698internal DateTime? HoverEnd
716internal DateTime DisplayMonth
724internal DateTime DisplayYear
844internal CalendarDayButton FindDayButtonFromDay(DateTime day)
850if (b.DataContext is DateTime)
852if (DateTimeHelper.CompareDays((DateTime)b.DataContext, day) == 0)
865return (value == null) || (!cal.BlackoutDates.Contains((DateTime)value));
887internal void OnDayClick(DateTime selectedDate)
907if (b.DataContext is DateTime d)
909DateTime? newDate = null;
951private DateTime? GetDateOffset(DateTime date, int offset, CalendarMode displayMode)
953DateTime? result = null;
982private void MoveDisplayTo(DateTime? date)
986DateTime d = date.Value.Date;
1018DateTime? nextDate = GetDateOffset(this.DisplayDate, 1, this.DisplayMode);
1027DateTime? nextDate = GetDateOffset(this.DisplayDate, -1, this.DisplayMode);
1113foreach (DateTime addedDate in e.AddedItems)
1154if (cal.BlackoutDates.Contains((DateTime)value))
1160return DateTime.Compare((DateTime)value, cal.DisplayDateStartInternal) >= 0 && DateTime.Compare((DateTime)value, cal.DisplayDateEndInternal) <= 0;
1175private void OnSelectedMonthChanged(DateTime? selectedMonth)
1188private void OnSelectedYearChanged(DateTime? selectedYear)
1201internal void FocusDate(DateTime date)
1317DateTime? selectedDate = this._blackoutDates.GetNonBlackoutDate(DateTimeHelper.AddDays(this.CurrentDate, COLS), 1);
1333DateTime? selectedMonth = DateTimeHelper.AddMonths(this.DisplayDate, YEAR_COLS);
1349DateTime? selectedYear = DateTimeHelper.AddYears(this.DisplayDate, YEAR_COLS);
1364DateTime? selectedDate = new DateTime(this.DisplayDateInternal.Year, this.DisplayDateInternal.Month, 1);
1366if (DateTimeHelper.CompareYearMonth(DateTime.MaxValue, selectedDate.Value) > 0)
1374selectedDate = DateTime.MaxValue;
1384DateTime selectedMonth = new DateTime(this.DisplayDate.Year, 12, 1);
1391DateTime? selectedYear = new DateTime(DateTimeHelper.EndOfDecade(this.DisplayDate), 1, 1);
1427DateTime? selectedDate = new DateTime(this.DisplayDateInternal.Year, this.DisplayDateInternal.Month, 1);
1434DateTime selectedMonth = new DateTime(this.DisplayDate.Year, 1, 1);
1441DateTime? selectedYear = new DateTime(DateTimeHelper.DecadeOfDate(this.DisplayDate), 1, 1);
1455DateTime? selectedDate = this._blackoutDates.GetNonBlackoutDate(DateTimeHelper.AddDays(this.CurrentDate, moveAmmount), moveAmmount);
1462DateTime? selectedMonth = DateTimeHelper.AddMonths(this.DisplayDate, moveAmmount);
1469DateTime? selectedYear = DateTimeHelper.AddYears(this.DisplayDate, moveAmmount);
1482DateTime? selectedDate = this._blackoutDates.GetNonBlackoutDate(DateTimeHelper.AddMonths(this.CurrentDate, 1), 1);
1489DateTime? selectedMonth = DateTimeHelper.AddYears(this.DisplayDate, 1);
1496DateTime? selectedYear = DateTimeHelper.AddYears(this.DisplayDate, 10 );
1509DateTime? selectedDate = this._blackoutDates.GetNonBlackoutDate(DateTimeHelper.AddMonths(this.CurrentDate, -1), -1);
1516DateTime? selectedMonth = DateTimeHelper.AddYears(this.DisplayDate, -1);
1523DateTime? selectedYear = DateTimeHelper.AddYears(this.DisplayDate, -10);
1537DateTime? selectedDate = this._blackoutDates.GetNonBlackoutDate(DateTimeHelper.AddDays(this.CurrentDate, moveAmmount), moveAmmount);
1544DateTime? selectedMonth = DateTimeHelper.AddMonths(this.DisplayDate, moveAmmount);
1551DateTime? selectedYear = DateTimeHelper.AddYears(this.DisplayDate, moveAmmount);
1558private void ProcessSelection(bool shift, DateTime? lastSelectedDate)
1582if (DateTime.Compare(this.HoverStart.Value, lastSelectedDate.Value) < 0)
1650DateTime? selectedDate = this._blackoutDates.GetNonBlackoutDate(DateTimeHelper.AddDays(this.CurrentDate, -COLS), -1);
1666DateTime? selectedMonth = DateTimeHelper.AddMonths(this.DisplayDate, -YEAR_COLS);
1677DateTime? selectedYear = DateTimeHelper.AddYears(this.DisplayDate, -YEAR_COLS);
System\Windows\Controls\DatePicker.cs (56)
45private DateTime? _originalSelectedDate;
103this.SetCurrentValueInternal(DisplayDateProperty, DateTime.Today);
148public DateTime DisplayDate
150get { return (DateTime)GetValue(DisplayDateProperty); }
160typeof(DateTime),
162new FrameworkPropertyMetadata(DateTime.Now, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, null, CoerceDisplayDate));
169dp._calendar.DisplayDate = (DateTime)value;
181public DateTime? DisplayDateEnd
183get { return (DateTime?)GetValue(DisplayDateEndProperty); }
193typeof(DateTime?),
215dp._calendar.DisplayDateEnd = (DateTime?)value;
227public DateTime? DisplayDateStart
229get { return (DateTime?)GetValue(DisplayDateStartProperty); }
239typeof(DateTime?),
262dp._calendar.DisplayDateStart = (DateTime?)value;
409public DateTime? SelectedDate
411get { return (DateTime?)GetValue(SelectedDateProperty); }
421typeof(DateTime?),
435Collection<DateTime> addedItems = new Collection<DateTime>();
436Collection<DateTime> removedItems = new Collection<DateTime>();
437DateTime? addedDate;
438DateTime? removedDate;
444addedDate = (DateTime?)e.NewValue;
445removedDate = (DateTime?)e.OldValue;
449DateTime day = dp.SelectedDate.Value;
493dp._calendar.SelectedDate = (DateTime?)value;
540DateTime? date = dp.ParseText(dp._textBox.Text);
544dp.SetTextInternal(dp.DateTimeToString((DateTime)date));
730_textBox.Text = this.DateTimeToString((DateTime)this.SelectedDate);
963SetCurrentValueInternal(DisplayDateProperty, (DateTime)e.AddedDate);
971if (e.AddedItems.Count > 0 && this.SelectedDate.HasValue && DateTime.Compare((DateTime)e.AddedItems[0], this.SelectedDate.Value) != 0)
973this.SetCurrentValueInternal(SelectedDateProperty, (DateTime?)e.AddedItems[0]);
979this.SetCurrentValueInternal(SelectedDateProperty, (DateTime?)null);
987this.SetCurrentValueInternal(SelectedDateProperty, (DateTime?)e.AddedItems[0]);
993private string DateTimeToString(DateTime d)
1013private static DateTime DiscardDayTime(DateTime d)
1017DateTime newD = new DateTime(year, month, 1, 0, 0, 0);
1021private static DateTime? DiscardTime(DateTime? d)
1029DateTime discarded = (DateTime)d;
1033DateTime newD = new DateTime(year, month, day, 0, 0, 0);
1111private DateTime? ParseText(string text)
1113DateTime newSelectedDate;
1118newSelectedDate = DateTime.Parse(text, DateTimeHelper.GetDateFormat(DateTimeHelper.GetCulture(this)));
1204DateTime? d = SetTextBoxValue(s);
1215this.SetCurrentValueInternal(SelectedDateProperty, (DateTime?)null);
1221DateTime? d = SetTextBoxValue(_defaultText);
1240private DateTime? SetTextBoxValue(string s)
1249DateTime? d = ParseText(s);
1253SafeSetText(this.DateTimeToString((DateTime)d));
1262string newtext = this.DateTimeToString((DateTime)this.SelectedDate);
System\Windows\Controls\DateTimeHelper.cs (33)
15public static DateTime? AddDays(DateTime time, int days)
27public static DateTime? AddMonths(DateTime time, int months)
39public static DateTime? AddYears(DateTime time, int years)
51public static DateTime? SetYear(DateTime date, int year)
56public static DateTime? SetYearMonth(DateTime date, DateTime yearMonth)
58DateTime? target = SetYear(date, yearMonth.Year);
67public static int CompareDays(DateTime dt1, DateTime dt2)
69return DateTime.Compare(DiscardTime(dt1).Value, DiscardTime(dt2).Value);
72public static int CompareYearMonth(DateTime dt1, DateTime dt2)
77public static int DecadeOfDate(DateTime date)
82public static DateTime DiscardDayTime(DateTime d)
87public static DateTime? DiscardTime(DateTime? d)
97public static int EndOfDecade(DateTime date)
170public static bool InRange(DateTime date, CalendarDateRange range)
176public static bool InRange(DateTime date, DateTime start, DateTime end)
178Debug.Assert(DateTime.Compare(start, end) < 1);
190public static string ToDayString(DateTime? date, CultureInfo culture)
220public static string ToYearMonthPatternString(DateTime? date, CultureInfo culture)
233public static string ToYearString(DateTime? date, CultureInfo culture)
246public static string ToAbbreviatedMonthString( DateTime? date, CultureInfo culture)
263public static string ToLongDateString(DateTime? date, CultureInfo culture)
System\Windows\Controls\Primitives\CalendarItem.cs (51)
130private DateTime DisplayDate
134return (Owner != null) ? Owner.DisplayDate : DateTime.Today;
291DateTime selectedYear;
299selectedYear = DateTime.Today;
372internal CalendarDayButton GetCalendarDayButton(DateTime date)
376if (b != null && b.DataContext is DateTime)
378if (DateTimeHelper.CompareDays(date, (DateTime)b.DataContext) == 0)
388internal CalendarButton GetCalendarButton(DateTime date, CalendarMode mode)
394if (b != null && b.DataContext is DateTime)
398if (DateTimeHelper.CompareYearMonth(date, (DateTime)b.DataContext) == 0)
405if (date.Year == ((DateTime)b.DataContext).Year)
441internal void FocusDate(DateTime date)
477private int GetDecadeForDecadeMode(DateTime selectedYear)
493child.DataContext is DateTime &&
494((DateTime)child.DataContext).Year == selectedYear.Year)
504child.DataContext is DateTime &&
505((DateTime)child.DataContext).Year == selectedYear.Year)
514private void EndDrag(bool ctrl, DateTime selectedDate)
524DateTime.Compare(this.Owner.HoverStart.Value, selectedDate) == 0 &&
564if (!(b.DataContext is DateTime))
572DateTime clickedDate = (DateTime)b.DataContext;
600DateTime? lastDate = this.Owner.CurrentDate;
658if (this.Owner == null || !(b.DataContext is DateTime))
677DateTime selectedDate = (DateTime)b.DataContext;
765if (this.Owner == null || !(b.DataContext is DateTime))
770DateTime selectedDate = (DateTime)b.DataContext;
816if (!(b.DataContext is DateTime))
821FinishSelection((DateTime)b.DataContext);
825private void FinishSelection(DateTime selectedDate)
1031DateTime firstDayOfMonth = DateTimeHelper.DiscardDayTime(DisplayDate);
1034bool isMinMonth = DateTimeHelper.CompareYearMonth(firstDayOfMonth, DateTime.MinValue) <= 0;
1035bool isMaxMonth = DateTimeHelper.CompareYearMonth(firstDayOfMonth, DateTime.MaxValue) >= 0;
1049DateTime dateToAdd = _calendar.AddDays(firstDayOfMonth, dayOffset);
1063private void SetMonthModeDayButtonState(CalendarDayButton childButton, DateTime? dateToAdd)
1092if (DateTimeHelper.CompareDays(dateToAdd.Value, DateTime.Today) == 0)
1108foreach (DateTime item in this.Owner.SelectedDates)
1138DateTime hStart = owner.HoverEnd.Value;
1139DateTime hEnd = owner.HoverEnd.Value;
1156if (childButton.DataContext is DateTime date)
1197DateTime firstDayOfMonth = DateTimeHelper.DiscardDayTime(DisplayDate);
1200if (DateTimeHelper.CompareYearMonth(firstDayOfMonth, DateTime.MaxValue) == 0)
1208DateTime firstDayOfNextMonth = _calendar.AddMonths(firstDayOfMonth, 1);
1218DateTime firstDayOfMonth = DateTimeHelper.DiscardDayTime(DisplayDate);
1237if (year <= DateTime.MaxValue.Year && year >= DateTime.MinValue.Year)
1240DateTime day = new DateTime(year, 1, 1);
1284DateTime day = new DateTime(DisplayDate.Year, count + 1, 1);
1367private int GetNumberOfDisplayedDaysFromPreviousMonth(DateTime firstOfMonth)
System\Windows\Controls\SelectedDatesCollection.cs (50)
14public sealed class SelectedDatesCollection : ObservableCollection<DateTime>
17private Collection<DateTime> _addedItems;
18private Collection<DateTime> _removedItems;
22private DateTime? _maximumDate;
23private DateTime? _minimumDate;
35this._addedItems = new Collection<DateTime>();
36this._removedItems = new Collection<DateTime>();
41internal DateTime? MinimumDate
52DateTime result = this[0];
53foreach (DateTime selectedDate in this)
55if (DateTime.Compare(selectedDate, result) < 0)
68internal DateTime? MaximumDate
79DateTime result = this[0];
80foreach (DateTime selectedDate in this)
82if (DateTime.Compare(selectedDate, result) > 0)
104public void AddRange(DateTime start, DateTime end)
114foreach (DateTime current in GetDaysInRange(start, end))
147protected override void InsertItem(int index, DateTime item)
156Collection<DateTime> addedItems = new Collection<DateTime>();
174if (index == 0 && !(this._owner.SelectedDate.HasValue && DateTime.Compare(this._owner.SelectedDate.Value, item) == 0))
222Collection<DateTime> addedItems = new Collection<DateTime>();
223Collection<DateTime> removedItems = new Collection<DateTime>();
257protected override void SetItem(int index, DateTime item)
266Collection<DateTime> addedItems = new Collection<DateTime>();
267Collection<DateTime> removedItems = new Collection<DateTime>();
276if (DateTime.Compare(this[index], item) != 0 && Calendar.IsValidDateSelection(this._owner, item))
285if (index == 0 && !(this._owner.SelectedDate.HasValue && DateTime.Compare(this._owner.SelectedDate.Value, item) == 0))
314internal void AddRangeInternal(DateTime start, DateTime end)
320DateTime lastAddedDate = start;
321foreach (DateTime current in GetDaysInRange(start, end))
350foreach (DateTime item in this)
367Collection<DateTime> addedItems = new Collection<DateTime>();
377internal void Toggle(DateTime date)
472private void UpdateMinMax(DateTime date)
491private static IEnumerable<DateTime> GetDaysInRange(DateTime start, DateTime end)
497DateTime? rangeStart = start;
504while (rangeStart.HasValue && DateTime.Compare(end, rangeStart.Value) != -increment);
507private static int GetDirection(DateTime start, DateTime end)
509return (DateTime.Compare(end, start) >= 0) ? 1 : -1;
PresentationFramework.Tests (1)
PresentationUI (55)
MS\Internal\Documents\RightsManagementProvider.cs (16)
539DateTime.MinValue,
540DateTime.MaxValue);
710DateTime.MinValue,
711DateTime.MaxValue);
781DateTime.MinValue,
782DateTime.MaxValue);
841grantList.Add(CreateGrant(_user, ContentRight.Owner, DateTime.MinValue, DateTime.MaxValue));
1070ValidFrom = DateTime.MinValue,
1071ValidUntil = DateTime.MaxValue
1080DateTime validFrom = DateTime.MinValue;
1081DateTime validUntil = DateTime.MaxValue;
1312private ContentGrant CreateGrant(RightsManagementUser user, ContentRight right, DateTime validFrom, DateTime validUntil)
QueueSharing (1)
ReachFramework (8)
Redis.ApiService (3)
ResponseCachingSample (1)
Roslyn.Diagnostics.Analyzers (7)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
737is nameof(DateTime)
Roslyn.Diagnostics.CSharp.Analyzers (1)
Roslyn.Test.PdbUtilities (1)
Roslyn.Test.Performance.Utilities (2)
Roslyn.VisualStudio.Next.UnitTests (2)
RunTests (8)
rzc (3)
Sample (11)
Endpoints\MapResponsesEndpoints.cs (4)
11responses.MapGet("/200-add-xml", () => new TodoWithDueDate(1, "Test todo", false, DateTime.Now.AddDays(1), DateTime.Now))
14responses.MapGet("/200-only-xml", () => new TodoWithDueDate(1, "Test todo", false, DateTime.Now.AddDays(1), DateTime.Now))
src\OpenApi\test\Microsoft.AspNetCore.OpenApi.Tests\Shared\SharedTypes.cs (3)
20internal record Todo(int Id, string Title, bool Completed, DateTime CreatedAt);
30internal record TodoWithDueDate(int Id, string Title, bool Completed, DateTime CreatedAt, DateTime DueDate) : Todo(Id, Title, Completed, CreatedAt);
ScenarioTests.Common.Tests (15)
Security.TransportSecurity.IntegrationTests (2)
SecurityWebSite (1)
SelfHostServer (1)
ServiceBusWorker (1)
SessionSample (1)
Shared.Tests (4)
SignalR.Client.FunctionalTestApp (2)
Sockets.BindTests (1)
Sockets.FunctionalTests (8)
Stress.ApiService (1)
Stress.TelemetryService (12)
TelemetryStresser.cs (6)
60CreateSumMetric("Test-<b>Bold</b>", DateTime.UtcNow, value: value)
68CreateSumMetric("Test-<b>Bold</b>", DateTime.UtcNow, value: value)
95public static Metric CreateSumMetric(string metricName, DateTime startTime, KeyValuePair<string, string>[]? attributes = null, int? value = null)
114private static NumberDataPoint CreateNumberPoint(DateTime startTime, int value, KeyValuePair<string, string>[]? attributes = null)
133public static ulong DateTimeToUnixNanoseconds(DateTime dateTime)
135var unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
System.Collections.Immutable (1)
System.ComponentModel.TypeConverter (22)
System\ComponentModel\DateTimeConverter.cs (17)
12/// Provides a type converter to convert <see cref='System.DateTime'/>
19/// object in the given source type to a <see cref='System.DateTime'/>
37/// Converts the given value object to a <see cref='System.DateTime'/> object.
46return DateTime.MinValue;
61return DateTime.Parse(text, formatInfo);
65return DateTime.Parse(text, culture);
70throw new FormatException(SR.Format(SR.ConvertInvalidPrimitive, (string)value, nameof(DateTime)), e);
78/// Converts the given value object to a <see cref='System.DateTime'/>
83if (destinationType == typeof(string) && value is DateTime)
85DateTime dt = (DateTime)value;
86if (dt == DateTime.MinValue)
120if (destinationType == typeof(InstanceDescriptor) && value is DateTime)
122DateTime dt = (DateTime)value;
126typeof(DateTime).GetConstructor(new Type[] { typeof(long) }),
132typeof(DateTime).GetConstructor(new Type[] { typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int) }),
System.Configuration.ConfigurationManager (17)
System.Data.Common (102)
System\Data\Common\DateTimeStorage.cs (30)
12private static readonly DateTime s_defaultValue = DateTime.MinValue;
14private DateTime[] _values = default!; // Late-initialized
17: base(column, typeof(DateTime), s_defaultValue, StorageType.DateTime)
29DateTime min = DateTime.MaxValue;
35min = (DateTime.Compare(_values[record], min) < 0) ? _values[record] : min;
46DateTime max = DateTime.MinValue;
52max = (DateTime.Compare(_values[record], max) >= 0) ? _values[record] : max;
83throw ExprException.Overflow(typeof(DateTime));
90DateTime valueNo1 = _values[recordNo1];
91DateTime valueNo2 = _values[recordNo2];
101return DateTime.Compare(valueNo1, valueNo2);
114DateTime valueNo1 = _values[recordNo];
119return DateTime.Compare(valueNo1, (DateTime)value);
146DateTime value = _values[record];
164DateTime retVal;
165DateTime tmpValue = ((IConvertible)value).ToDateTime(FormatProvider);
179retVal = DateTime.SpecifyKind(tmpValue, DateTimeKind.Utc);
193retVal = DateTime.SpecifyKind(tmpValue, DateTimeKind.Local);
198retVal = DateTime.SpecifyKind(tmpValue, DateTimeKind.Unspecified);
237retValue = XmlConvert.ToString((DateTime)value, XmlDateTimeSerializationMode.Local);
241retValue = XmlConvert.ToString((DateTime)value, XmlDateTimeSerializationMode.RoundtripKind);
248return new DateTime[recordCount];
253DateTime[] typedStore = (DateTime[])store;
268_values = (DateTime[])store;
276_values[i] = DateTime.SpecifyKind(_values[i].ToLocalTime(), DateTimeKind.Unspecified); //Strip the kind for UnspecifiedLocal.
System\Data\Filter\FunctionNode.cs (3)
32new Function("DateTimeOffset", FunctionId.DateTimeOffset, typeof(DateTimeOffset), false, true, 3, typeof(DateTime), typeof(int), typeof(int)),
535switch (((DateTime)argumentValues[0]).Kind)
561return new DateTimeOffset((DateTime)argumentValues[0], new TimeSpan((int)argumentValues[1], (int)argumentValues[2], 0));
System\Data\XDRSchema.cs (5)
237new NameType("date", typeof(DateTime)),
238new NameType("dateTime", typeof(DateTime)),
239new NameType("dateTime.tz", typeof(DateTime)),
260new NameType("time", typeof(DateTime)),
261new NameType("time.tz", typeof(DateTime)),
System\Data\XMLSchema.cs (8)
1816new NameType("date", typeof(DateTime) ), /* XSD Apr */
1817new NameType("dateTime", typeof(DateTime) ), /* XSD Apr */
1822new NameType("gDay", typeof(DateTime) ), /* XSD Apr */
1823new NameType("gMonth", typeof(DateTime) ), /* XSD Apr */
1824new NameType("gMonthDay", typeof(DateTime) ), /* XSD Apr */
1825new NameType("gYear", typeof(DateTime) ), /* XSD Apr */
1826new NameType("gYearMonth", typeof(DateTime) ), /* XSD Apr */
1839new NameType("time", typeof(DateTime) ), /* XSD Apr */
System.Data.Odbc (20)
System\Data\Odbc\Odbc32.cs (3)
770private static readonly TypeMap s_dateTime = new TypeMap(OdbcType.DateTime, DbType.DateTime, typeof(DateTime), ODBC32.SQL_TYPE.TYPE_TIMESTAMP, ODBC32.SQL_C.TYPE_TIMESTAMP, ODBC32.SQL_C.TYPE_TIMESTAMP, 16, 23, false);
771private static readonly TypeMap s_date = new TypeMap(OdbcType.Date, DbType.Date, typeof(DateTime), ODBC32.SQL_TYPE.TYPE_DATE, ODBC32.SQL_C.TYPE_DATE, ODBC32.SQL_C.TYPE_DATE, 6, 10, false);
784private static readonly TypeMap s_smallDT = new TypeMap(OdbcType.SmallDateTime, DbType.DateTime, typeof(DateTime), ODBC32.SQL_TYPE.TYPE_TIMESTAMP, ODBC32.SQL_C.TYPE_TIMESTAMP, ODBC32.SQL_C.TYPE_TIMESTAMP, 16, 23, false);
System.Data.OleDb (1)
System.Diagnostics.DiagnosticSource (34)
System.Diagnostics.EventLog (7)
System.Diagnostics.Process (16)
System.Diagnostics.TextWriterTraceListener (2)
System.Diagnostics.TraceSource (5)
System.DirectoryServices (8)
System.DirectoryServices.AccountManagement (30)
artifacts\obj\System.DirectoryServices.AccountManagement\Debug\net10.0\System.DirectoryServices.AccountManagement.notsupported.cs (30)
12public void AccountExpirationDate(System.DateTime expirationTime, System.DirectoryServices.AccountManagement.MatchType match) { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); }
13public void AccountLockoutTime(System.DateTime lockoutTime, System.DirectoryServices.AccountManagement.MatchType match) { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); }
16public void LastBadPasswordAttempt(System.DateTime lastAttempt, System.DirectoryServices.AccountManagement.MatchType match) { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); }
17public void LastLogonTime(System.DateTime logonTime, System.DirectoryServices.AccountManagement.MatchType match) { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); }
18public void LastPasswordSetTime(System.DateTime passwordSetTime, System.DirectoryServices.AccountManagement.MatchType match) { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); }
25public System.DateTime? AccountExpirationDate { get { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); } set { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); } }
26public System.DateTime? AccountLockoutTime { get { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); } }
35public System.DateTime? LastBadPasswordAttempt { get { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); } }
36public System.DateTime? LastLogon { get { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); } }
37public System.DateTime? LastPasswordSet { get { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); } }
47public static System.DirectoryServices.AccountManagement.PrincipalSearchResult<System.DirectoryServices.AccountManagement.AuthenticablePrincipal> FindByBadPasswordAttempt(System.DirectoryServices.AccountManagement.PrincipalContext context, System.DateTime time, System.DirectoryServices.AccountManagement.MatchType type) { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); }
48protected static System.DirectoryServices.AccountManagement.PrincipalSearchResult<T> FindByBadPasswordAttempt<T>(System.DirectoryServices.AccountManagement.PrincipalContext context, System.DateTime time, System.DirectoryServices.AccountManagement.MatchType type) { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); }
49public static System.DirectoryServices.AccountManagement.PrincipalSearchResult<System.DirectoryServices.AccountManagement.AuthenticablePrincipal> FindByExpirationTime(System.DirectoryServices.AccountManagement.PrincipalContext context, System.DateTime time, System.DirectoryServices.AccountManagement.MatchType type) { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); }
50protected static System.DirectoryServices.AccountManagement.PrincipalSearchResult<T> FindByExpirationTime<T>(System.DirectoryServices.AccountManagement.PrincipalContext context, System.DateTime time, System.DirectoryServices.AccountManagement.MatchType type) { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); }
51public static System.DirectoryServices.AccountManagement.PrincipalSearchResult<System.DirectoryServices.AccountManagement.AuthenticablePrincipal> FindByLockoutTime(System.DirectoryServices.AccountManagement.PrincipalContext context, System.DateTime time, System.DirectoryServices.AccountManagement.MatchType type) { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); }
52protected static System.DirectoryServices.AccountManagement.PrincipalSearchResult<T> FindByLockoutTime<T>(System.DirectoryServices.AccountManagement.PrincipalContext context, System.DateTime time, System.DirectoryServices.AccountManagement.MatchType type) { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); }
53public static System.DirectoryServices.AccountManagement.PrincipalSearchResult<System.DirectoryServices.AccountManagement.AuthenticablePrincipal> FindByLogonTime(System.DirectoryServices.AccountManagement.PrincipalContext context, System.DateTime time, System.DirectoryServices.AccountManagement.MatchType type) { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); }
54protected static System.DirectoryServices.AccountManagement.PrincipalSearchResult<T> FindByLogonTime<T>(System.DirectoryServices.AccountManagement.PrincipalContext context, System.DateTime time, System.DirectoryServices.AccountManagement.MatchType type) { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); }
55public static System.DirectoryServices.AccountManagement.PrincipalSearchResult<System.DirectoryServices.AccountManagement.AuthenticablePrincipal> FindByPasswordSetTime(System.DirectoryServices.AccountManagement.PrincipalContext context, System.DateTime time, System.DirectoryServices.AccountManagement.MatchType type) { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); }
56protected static System.DirectoryServices.AccountManagement.PrincipalSearchResult<T> FindByPasswordSetTime<T>(System.DirectoryServices.AccountManagement.PrincipalContext context, System.DateTime time, System.DirectoryServices.AccountManagement.MatchType type) { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); }
68public static new System.DirectoryServices.AccountManagement.PrincipalSearchResult<System.DirectoryServices.AccountManagement.ComputerPrincipal> FindByBadPasswordAttempt(System.DirectoryServices.AccountManagement.PrincipalContext context, System.DateTime time, System.DirectoryServices.AccountManagement.MatchType type) { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); }
69public static new System.DirectoryServices.AccountManagement.PrincipalSearchResult<System.DirectoryServices.AccountManagement.ComputerPrincipal> FindByExpirationTime(System.DirectoryServices.AccountManagement.PrincipalContext context, System.DateTime time, System.DirectoryServices.AccountManagement.MatchType type) { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); }
72public static new System.DirectoryServices.AccountManagement.PrincipalSearchResult<System.DirectoryServices.AccountManagement.ComputerPrincipal> FindByLockoutTime(System.DirectoryServices.AccountManagement.PrincipalContext context, System.DateTime time, System.DirectoryServices.AccountManagement.MatchType type) { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); }
73public static new System.DirectoryServices.AccountManagement.PrincipalSearchResult<System.DirectoryServices.AccountManagement.ComputerPrincipal> FindByLogonTime(System.DirectoryServices.AccountManagement.PrincipalContext context, System.DateTime time, System.DirectoryServices.AccountManagement.MatchType type) { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); }
74public static new System.DirectoryServices.AccountManagement.PrincipalSearchResult<System.DirectoryServices.AccountManagement.ComputerPrincipal> FindByPasswordSetTime(System.DirectoryServices.AccountManagement.PrincipalContext context, System.DateTime time, System.DirectoryServices.AccountManagement.MatchType type) { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); }
400public static new System.DirectoryServices.AccountManagement.PrincipalSearchResult<System.DirectoryServices.AccountManagement.UserPrincipal> FindByBadPasswordAttempt(System.DirectoryServices.AccountManagement.PrincipalContext context, System.DateTime time, System.DirectoryServices.AccountManagement.MatchType type) { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); }
401public static new System.DirectoryServices.AccountManagement.PrincipalSearchResult<System.DirectoryServices.AccountManagement.UserPrincipal> FindByExpirationTime(System.DirectoryServices.AccountManagement.PrincipalContext context, System.DateTime time, System.DirectoryServices.AccountManagement.MatchType type) { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); }
404public static new System.DirectoryServices.AccountManagement.PrincipalSearchResult<System.DirectoryServices.AccountManagement.UserPrincipal> FindByLockoutTime(System.DirectoryServices.AccountManagement.PrincipalContext context, System.DateTime time, System.DirectoryServices.AccountManagement.MatchType type) { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); }
405public static new System.DirectoryServices.AccountManagement.PrincipalSearchResult<System.DirectoryServices.AccountManagement.UserPrincipal> FindByLogonTime(System.DirectoryServices.AccountManagement.PrincipalContext context, System.DateTime time, System.DirectoryServices.AccountManagement.MatchType type) { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); }
406public static new System.DirectoryServices.AccountManagement.PrincipalSearchResult<System.DirectoryServices.AccountManagement.UserPrincipal> FindByPasswordSetTime(System.DirectoryServices.AccountManagement.PrincipalContext context, System.DateTime time, System.DirectoryServices.AccountManagement.MatchType type) { throw new System.PlatformNotSupportedException(System.SR.DirectoryServicesAccountManagement_PlatformNotSupported); }
System.DirectoryServices.Protocols (3)
System.Drawing.Common.Tests (1)
System.Formats.Nrbf (22)
System.Formats.Tar (3)
System.IO.Compression (3)
System.IO.Compression.ZipFile (1)
System.IO.Packaging (13)
System.Linq.Expressions (9)
System.Linq.Parallel (12)
System.Management (2)
System.Net.Http (1)
System.Net.HttpListener (4)
System.Net.Mail (14)
System.Net.Primitives (26)
System.Net.Quic (1)
System.Net.Requests (35)
System.Net.Security (15)
System\Net\NegotiateAuthenticationPal.ManagedNtlm.cs (5)
398private unsafe void makeNtlm2ChallengeResponse(DateTime time, ReadOnlySpan<byte> ntlm2hash, ReadOnlySpan<byte> serverChallenge, Span<byte> clientChallenge, ReadOnlySpan<byte> serverInfo, ref MessageField field, Span<byte> payload, ref int payloadOffset)
457private byte[] ProcessTargetInfo(ReadOnlySpan<byte> targetInfo, out DateTime time, out bool hasNbNames)
470time = DateTime.UtcNow;
489time = DateTime.FromFileTimeUtc(BitConverter.ToInt64(info.Slice(4, 8)));
598byte[] targetInfoBuffer = ProcessTargetInfo(targetInfo, out DateTime time, out bool hasNbNames);
System.Net.Sockets (3)
System.Net.WebClient (1)
System.Private.CoreLib (1003)
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.Date.Helpers.cs (6)
14private static bool TryCreateDateTimeOffset(DateTime dateTime, bool offsetNegative, int offsetHours, int offsetMinutes, out DateTimeOffset value)
60if (!TryCreateDateTime(year: year, month: month, day: day, hour: hour, minute: minute, second: second, fraction: fraction, kind: DateTimeKind.Unspecified, out DateTime dateTime))
80if (!TryCreateDateTime(year: year, month: month, day: day, hour: hour, minute: minute, second: second, fraction: fraction, DateTimeKind.Local, out DateTime dateTime))
105private static bool TryCreateDateTime(int year, int month, int day, int hour, int minute, int second, int fraction, DateTimeKind kind, out DateTime value)
122if (dayMinusOne >= 28 && dayMinusOne >= DateTime.DaysInMonth(year, month))
148ReadOnlySpan<int> days = DateTime.IsLeapYear(year) ? GregorianCalendar.DaysToMonth366 : GregorianCalendar.DaysToMonth365;
src\libraries\System.Private.CoreLib\src\System\DateTime.cs (113)
53IComparable<DateTime>,
54IEquatable<DateTime>,
56ISpanParsable<DateTime>,
114public static readonly DateTime MinValue;
115public static readonly DateTime MaxValue = new DateTime(MaxTicks, DateTimeKind.Unspecified);
116public static readonly DateTime UnixEpoch = new DateTime(UnixEpochTicks, DateTimeKind.Utc);
155internal static DateTime CreateUnchecked(long ticks) => new DateTime((ulong)ticks);
165/// Initializes a new instance of the <see cref="DateTime"/> structure to the specified <see cref="DateOnly"/> and <see cref="TimeOnly"/>.
180/// Initializes a new instance of the <see cref="DateTime"/> structure to the specified <see cref="DateOnly"/> and <see cref="TimeOnly"/> respecting a <see cref="DateTimeKind"/>.
230/// Initializes a new instance of the <see cref="DateTime"/> structure to the specified year, month, day, hour, minute, second,
375/// Initializes a new instance of the <see cref="DateTime"/> structure to the specified year, month, day, hour, minute, second,
414/// in the Gregorian calendar. To instantiate a <see cref="DateTime"/> value by using the year, month and day in another calendar, call
430/// Initializes a new instance of the <see cref="DateTime"/> structure to the specified year, month, day, hour, minute, second,
476/// in the Gregorian calendar. To instantiate a <see cref="DateTime"/> value by using the year, month and day in another calendar, call
490/// Initializes a new instance of the <see cref="DateTime"/> structure to the specified year, month, day, hour, minute, second,
561/// Initializes a new instance of the <see cref="DateTime"/> structure to the specified year, month, day, hour, minute, second,
605/// in the Gregorian calendar. To instantiate a <see cref="DateTime"/> value by using the year, month and day in another calendar, call
619/// Initializes a new instance of the <see cref="DateTime"/> structure to the specified year, month, day, hour, minute, second,
670/// in the Gregorian calendar. To instantiate a <see cref="DateTime"/> value by using the year, month and day in another calendar, call
684/// Initializes a new instance of the <see cref="DateTime"/> structure to the specified year, month, day, hour, minute, second,
744/// Initializes a new instance of the <see cref="DateTime"/> structure to the specified year, month, day, hour, minute, second,
812internal static ulong ValidateLeapSecond(DateTime value)
860public DateTime Add(TimeSpan value)
866private DateTime AddUnits(double value, long maxUnitCount, long ticksPerUnit)
882/// Returns a new <see cref="DateTime"/> that adds the specified number of days to the value of this instance.
888public DateTime AddDays(double value) => AddUnits(value, MaxDays, TimeSpan.TicksPerDay);
891/// Returns a new <see cref="DateTime"/> that adds the specified number of hours to the value of this instance.
897public DateTime AddHours(double value) => AddUnits(value, MaxHours, TimeSpan.TicksPerHour);
900/// Returns a new <see cref="DateTime"/> that adds the specified number of milliseconds to the value of this instance.
906public DateTime AddMilliseconds(double value) => AddUnits(value, MaxMillis, TimeSpan.TicksPerMillisecond);
909/// Returns a new <see cref="DateTime"/> that adds the specified number of microseconds to the value of this instance.
921/// This method does not change the value of this <see cref="DateTime"/>. Instead, it returns a new <see cref="DateTime"/>
930/// The resulting <see cref="DateTime"/> is less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>.
932public DateTime AddMicroseconds(double value) => AddUnits(value, MaxMicroseconds, TimeSpan.TicksPerMicrosecond);
935/// Returns a new <see cref="DateTime"/> that adds the specified number of minutes to the value of this instance.
941public DateTime AddMinutes(double value) => AddUnits(value, MaxMinutes, TimeSpan.TicksPerMinute);
960public DateTime AddMonths(int months) => AddMonths(this, months);
961private static DateTime AddMonths(DateTime date, int months)
980/// Returns a new <see cref="DateTime"/> that adds the specified number of seconds to the value of this instance.
986public DateTime AddSeconds(double value) => AddUnits(value, MaxSeconds, TimeSpan.TicksPerSecond);
992public DateTime AddTicks(long value)
1000internal bool TryAddTicks(long value, out DateTime result)
1020public DateTime AddYears(int value) => AddYears(this, value);
1021private static DateTime AddYears(DateTime date, int value)
1049public static int Compare(DateTime t1, DateTime t2)
1067if (!(value is DateTime))
1072return Compare(this, (DateTime)value);
1075public int CompareTo(DateTime value)
1189return value is DateTime dt && this == dt;
1192public bool Equals(DateTime value)
1201public static bool Equals(DateTime t1, DateTime t2)
1206public static DateTime FromBinary(long dateData)
1232DateTime utcDt = new DateTime(ticks, DateTimeKind.Utc);
1260public static DateTime FromFileTime(long fileTime)
1265public static DateTime FromFileTimeUtc(long fileTime)
1284public static DateTime FromOADate(double d)
1307public static DateTime SpecifyKind(DateTime value, DateTimeKind kind)
1346public DateTime Date => new((UTicks / TimeSpan.TicksPerDay * TimeSpan.TicksPerDay) | InternalKind);
1507public static DateTime Now
1511DateTime utc = UtcNow;
1537public static DateTime Today => Now.Date;
1570public static DateTime Parse(string s)
1580public static DateTime Parse(string s, IFormatProvider? provider)
1586public static DateTime Parse(string s, IFormatProvider? provider, DateTimeStyles styles)
1593public static DateTime Parse(ReadOnlySpan<char> s, IFormatProvider? provider = null, DateTimeStyles styles = DateTimeStyles.None)
1603public static DateTime ParseExact(string s, [StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string format, IFormatProvider? provider)
1614public static DateTime ParseExact(string s, [StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string format, IFormatProvider? provider, DateTimeStyles style)
1622public static DateTime ParseExact(ReadOnlySpan<char> s, [StringSyntax(StringSyntaxAttribute.DateTimeFormat)] ReadOnlySpan<char> format, IFormatProvider? provider, DateTimeStyles style = DateTimeStyles.None)
1628public static DateTime ParseExact(string s, [StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string[] formats, IFormatProvider? provider, DateTimeStyles style)
1635public static DateTime ParseExact(ReadOnlySpan<char> s, [StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string[] formats, IFormatProvider? provider, DateTimeStyles style = DateTimeStyles.None)
1641public TimeSpan Subtract(DateTime value)
1646public DateTime Subtract(TimeSpan value)
1705public DateTime ToLocalTime()
1771public DateTime ToUniversalTime()
1774public static bool TryParse([NotNullWhen(true)] string? s, out DateTime result)
1784public static bool TryParse(ReadOnlySpan<char> s, out DateTime result)
1789public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, DateTimeStyles styles, out DateTime result)
1802public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, DateTimeStyles styles, out DateTime result)
1808public static bool TryParseExact([NotNullWhen(true)] string? s, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string? format, IFormatProvider? provider, DateTimeStyles style, out DateTime result)
1821public static bool TryParseExact(ReadOnlySpan<char> s, [StringSyntax(StringSyntaxAttribute.DateTimeFormat)] ReadOnlySpan<char> format, IFormatProvider? provider, DateTimeStyles style, out DateTime result)
1827public static bool TryParseExact([NotNullWhen(true)] string? s, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string?[]? formats, IFormatProvider? provider, DateTimeStyles style, out DateTime result)
1840public static bool TryParseExact(ReadOnlySpan<char> s, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string?[]? formats, IFormatProvider? provider, DateTimeStyles style, out DateTime result)
1846public static DateTime operator +(DateTime d, TimeSpan t)
1853public static DateTime operator -(DateTime d, TimeSpan t)
1860public static TimeSpan operator -(DateTime d1, DateTime d2) => new TimeSpan(d1.Ticks - d2.Ticks);
1862public static bool operator ==(DateTime d1, DateTime d2) => ((d1._dateData ^ d2._dateData) << 2) == 0;
1864public static bool operator !=(DateTime d1, DateTime d2) => !(d1 == d2);
1867public static bool operator <(DateTime t1, DateTime t2) => t1.Ticks < t2.Ticks;
1870public static bool operator <=(DateTime t1, DateTime t2) => t1.Ticks <= t2.Ticks;
1873public static bool operator >(DateTime t1, DateTime t2) => t1.Ticks > t2.Ticks;
1876public static bool operator >=(DateTime t1, DateTime t2) => t1.Ticks >= t2.Ticks;
1879/// Deconstructs <see cref="DateTime"/> into <see cref="DateOnly"/> and <see cref="TimeOnly"/>.
1964private static InvalidCastException InvalidCast(string to) => new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, nameof(DateTime), to));
1966DateTime IConvertible.ToDateTime(IFormatProvider? provider) => this;
1973internal static bool TryCreate(int year, int month, int day, int hour, int minute, int second, int millisecond, out DateTime result)
2023public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out DateTime result) => TryParse(s, provider, DateTimeStyles.None, out result);
2030public static DateTime Parse(ReadOnlySpan<char> s, IFormatProvider? provider) => Parse(s, provider, DateTimeStyles.None);
2033public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out DateTime result) => TryParse(s, provider, DateTimeStyles.None, out result);
src\libraries\System.Private.CoreLib\src\System\DateTimeOffset.cs (73)
54private const long UnixEpochSeconds = DateTime.UnixEpochTicks / TimeSpan.TicksPerSecond; // 62,135,596,800
55private const long UnixEpochMilliseconds = DateTime.UnixEpochTicks / TimeSpan.TicksPerMillisecond; // 62,135,596,800,000
57internal const long UnixMinSeconds = DateTime.MinTicks / TimeSpan.TicksPerSecond - UnixEpochSeconds;
58internal const long UnixMaxSeconds = DateTime.MaxTicks / TimeSpan.TicksPerSecond - UnixEpochSeconds;
62public static readonly DateTimeOffset MaxValue = new DateTimeOffset(0, DateTime.CreateUnchecked(DateTime.MaxTicks));
63public static readonly DateTimeOffset UnixEpoch = new DateTimeOffset(0, DateTime.CreateUnchecked(DateTime.UnixEpochTicks));
66private readonly DateTime _dateTime;
71private DateTimeOffset(int validOffsetMinutes, DateTime validDateTime)
75Debug.Assert((ulong)(validDateTime.Ticks + validOffsetMinutes * TimeSpan.TicksPerMinute) <= DateTime.MaxTicks);
85private static DateTimeOffset CreateValidateOffset(DateTime dateTime, TimeSpan offset) => new DateTimeOffset(ValidateOffset(offset), ValidateDate(dateTime, offset));
89public DateTimeOffset(DateTime dateTime)
101_dateTime = DateTime.SpecifyKind(dateTime, DateTimeKind.Unspecified);
108public DateTimeOffset(DateTime dateTime, TimeSpan offset)
145if (second != 60 || !DateTime.SystemSupportsLeapSeconds)
156private static DateTime WithLeapSecond(int year, int month, int day, int hour, int minute, TimeSpan offset)
160DateTime.ValidateLeapSecond(value.UtcDateTime);
169if ((uint)millisecond >= TimeSpan.MillisecondsPerSecond) DateTime.ThrowMillisecondOutOfRange();
170_dateTime = DateTime.CreateUnchecked(UtcTicks + (uint)millisecond * (uint)TimeSpan.TicksPerMillisecond);
180if (second != 60 || !DateTime.SystemSupportsLeapSeconds)
191private static DateTime WithLeapSecond(Calendar calendar, int year, int month, int day, int hour, int minute, int millisecond, TimeSpan offset)
195DateTime.ValidateLeapSecond(value.UtcDateTime);
254if ((uint)microsecond >= TimeSpan.MicrosecondsPerMillisecond) DateTime.ThrowMicrosecondOutOfRange();
255_dateTime = DateTime.CreateUnchecked(UtcTicks + (uint)microsecond * (uint)TimeSpan.TicksPerMicrosecond);
328if ((uint)microsecond >= TimeSpan.MicrosecondsPerMillisecond) DateTime.ThrowMicrosecondOutOfRange();
329_dateTime = DateTime.CreateUnchecked(UtcTicks + (uint)microsecond * (uint)TimeSpan.TicksPerMicrosecond);
332public static DateTimeOffset UtcNow => new DateTimeOffset(0, DateTime.SpecifyKind(DateTime.UtcNow, DateTimeKind.Unspecified));
334public DateTime DateTime => ClockDateTime;
336public DateTime UtcDateTime => DateTime.CreateUnchecked((long)(_dateTime._dateData | DateTime.KindUtc));
338public DateTime LocalDateTime => UtcDateTime.ToLocalTime();
349private DateTime ClockDateTime => DateTime.CreateUnchecked(UtcTicks + _offsetMinutes * TimeSpan.TicksPerMinute);
355public DateTime Date => ClockDateTime.Date;
533private DateTimeOffset Add(DateTime dateTime) => new DateTimeOffset(_offsetMinutes, ValidateDate(dateTime, Offset));
584ToLocalTime(DateTime.FromFileTimeUtc(fileTime), true);
593long ticks = seconds * TimeSpan.TicksPerSecond + DateTime.UnixEpochTicks;
594return new DateTimeOffset(0, DateTime.CreateUnchecked(ticks));
599const long MinMilliseconds = DateTime.MinTicks / TimeSpan.TicksPerMillisecond - UnixEpochMilliseconds;
600const long MaxMilliseconds = DateTime.MaxTicks / TimeSpan.TicksPerMillisecond - UnixEpochMilliseconds;
607long ticks = milliseconds * TimeSpan.TicksPerMillisecond + DateTime.UnixEpochTicks;
608return new DateTimeOffset(0, DateTime.CreateUnchecked(ticks));
638_dateTime = (DateTime)info.GetValue("DateTime", typeof(DateTime))!; // Do not rename (binary serialization)
654DateTime dateResult = DateTimeParse.Parse(input,
673DateTime dateResult = DateTimeParse.Parse(input,
683DateTime dateResult = DateTimeParse.Parse(input, DateTimeFormatInfo.GetInstance(formatProvider), styles, out TimeSpan offset);
704DateTime dateResult = DateTimeParse.ParseExact(input,
715DateTime dateResult = DateTimeParse.ParseExact(input, format, DateTimeFormatInfo.GetInstance(formatProvider), styles, out TimeSpan offset);
724DateTime dateResult = DateTimeParse.ParseExactMultiple(input,
735DateTime dateResult = DateTimeParse.ParseExactMultiple(input, formats, DateTimeFormatInfo.GetInstance(formatProvider), styles, out TimeSpan offset);
777private static DateTimeOffset ToLocalTime(DateTime utcDateTime, bool throwOnOverflow)
781if ((ulong)localTicks > DateTime.MaxTicks)
786localTicks = localTicks < DateTime.MinTicks ? DateTime.MinTicks : DateTime.MaxTicks;
789return CreateValidateOffset(DateTime.CreateUnchecked(localTicks), offset);
818out DateTime dateResult,
826bool parsed = DateTimeParse.TryParse(input, DateTimeFormatInfo.CurrentInfo, DateTimeStyles.None, out DateTime dateResult, out TimeSpan offset);
843out DateTime dateResult,
852bool parsed = DateTimeParse.TryParse(input, DateTimeFormatInfo.GetInstance(formatProvider), styles, out DateTime dateResult, out TimeSpan offset);
871out DateTime dateResult,
881bool parsed = DateTimeParse.TryParseExact(input, format, DateTimeFormatInfo.GetInstance(formatProvider), styles, out DateTime dateResult, out TimeSpan offset);
900out DateTime dateResult,
910bool parsed = DateTimeParse.TryParseExactMultiple(input, formats, DateTimeFormatInfo.GetInstance(formatProvider), styles, out DateTime dateResult, out TimeSpan offset);
933private static DateTime ValidateDate(DateTime dateTime, TimeSpan offset)
942if ((ulong)utcTicks > DateTime.MaxTicks)
948return DateTime.CreateUnchecked(utcTicks);
976public static implicit operator DateTimeOffset(DateTime dateTime) =>
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventPipeEventDispatcher.cs (9)
121DateTime syncTimeUtc = DateTime.FromFileTimeUtc(sessionInfo.StartTimeAsUTCFileTime);
148private unsafe bool DispatchEventsToEventListenersOnce(ulong sessionID, DateTime syncTimeUtc, long syncTimeQPC, long timeQPCFrequency, CancellationToken token)
165DateTime dateTimeStamp = TimeStampToDateTime(instanceData.TimeStamp, syncTimeUtc, syncTimeQPC, timeQPCFrequency);
175private static DateTime TimeStampToDateTime(long timeStamp, DateTime syncTimeUtc, long syncTimeQPC, long timeQPCFrequency)
179return DateTime.MaxValue;
184if ((inTicks < 0) || (DateTime.MaxTicks < inTicks))
186inTicks = DateTime.MaxTicks;
src\libraries\System.Private.CoreLib\src\System\Globalization\Calendar.cs (42)
31internal const long MaxMillis = (long)DateTime.DaysTo10000 * TimeSpan.MillisecondsPerDay;
37public virtual DateTime MinSupportedDateTime => DateTime.MinValue;
39public virtual DateTime MaxSupportedDateTime => DateTime.MaxValue;
110internal static void CheckAddResult(long ticks, DateTime minValue, DateTime maxValue)
118internal DateTime Add(DateTime time, double value, int scale)
146public virtual DateTime AddMilliseconds(DateTime time, double milliseconds)
158public virtual DateTime AddDays(DateTime time, int days)
170public virtual DateTime AddHours(DateTime time, int hours)
182public virtual DateTime AddMinutes(DateTime time, int minutes)
205public abstract DateTime AddMonths(DateTime time, int months);
214public virtual DateTime AddSeconds(DateTime time, int seconds)
222public virtual DateTime AddWeeks(DateTime time, int weeks)
236public abstract DateTime AddYears(DateTime time, int years);
242public abstract int GetDayOfMonth(DateTime time);
250public abstract DayOfWeek GetDayOfWeek(DateTime time);
256public abstract int GetDayOfYear(DateTime time);
291public abstract int GetEra(DateTime time);
301public virtual int GetHour(DateTime time) => time.Hour;
305public virtual double GetMilliseconds(DateTime time) => time.Millisecond;
309public virtual int GetMinute(DateTime time) => time.Minute;
313public abstract int GetMonth(DateTime time);
326public virtual int GetSecond(DateTime time) => time.Second;
361internal int GetFirstDayWeekOfYear(DateTime time, int firstDayOfWeek)
373private int GetWeekOfYearFullDays(DateTime time, int firstDayOfWeek, int fullDays)
474public virtual int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
500public abstract int GetYear(DateTime time);
585public virtual DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond)
594public abstract DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era);
596internal virtual bool TryToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era, out DateTime result)
598result = DateTime.MinValue;
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormat.cs (19)
260private static string FormatHebrewMonthName(DateTime time, int month, int repeatCount, DateTimeFormatInfo dtfi)
429DateTime dateTime, scoped ReadOnlySpan<char> format, DateTimeFormatInfo dtfi, TimeSpan offset, ref ValueListBuilder<TChar> result) where TChar : unmanaged, IUtfChar<TChar>
787private static unsafe void FormatCustomizedTimeZone<TChar>(DateTime dateTime, TimeSpan offset, int tokenLen, bool timeOnly, ref ValueListBuilder<TChar> result) where TChar : unmanaged, IUtfChar<TChar>
799offset = TimeZoneInfo.GetLocalUtcOffset(DateTime.Now, TimeZoneInfoOptions.NoThrowOnInvalidTime);
852private static unsafe void FormatCustomizedRoundripTimeZone<TChar>(DateTime dateTime, TimeSpan offset, ref ValueListBuilder<TChar> result) where TChar : unmanaged, IUtfChar<TChar>
917internal static string Format(DateTime dateTime, string? format, IFormatProvider? provider) =>
920internal static string Format(DateTime dateTime, string? format, IFormatProvider? provider, TimeSpan offset)
1029internal static bool TryFormat<TChar>(DateTime dateTime, Span<TChar> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider) where TChar : unmanaged, IUtfChar<TChar> =>
1032internal static bool TryFormat<TChar>(DateTime dateTime, Span<TChar> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider, TimeSpan offset) where TChar : unmanaged, IUtfChar<TChar>
1137private static bool IsTimeOnlySpecialCase(DateTime dateTime, DateTimeFormatInfo dtfi) =>
1158private static void PrepareFormatU(ref DateTime dateTime, ref DateTimeFormatInfo dtfi, TimeSpan offset)
1442internal static unsafe bool TryFormatO<TChar>(DateTime dateTime, TimeSpan offset, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1522internal static unsafe bool TryFormatS<TChar>(DateTime dateTime, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1557internal static unsafe bool TryFormatu<TChar>(DateTime dateTime, TimeSpan offset, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1598internal static unsafe bool TryFormatR<TChar>(DateTime dateTime, TimeSpan offset, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1663internal static unsafe bool TryFormatInvariantG<TChar>(DateTime value, TimeSpan offset, Span<TChar> destination, out int bytesWritten) where TChar : unmanaged, IUtfChar<TChar>
1719internal static string[] GetAllDateTimes(DateTime dateTime, char format, DateTimeFormatInfo dtfi)
1747DateTime universalTime = dateTime.ToUniversalTime();
1773internal static string[] GetAllDateTimes(DateTime dateTime, DateTimeFormatInfo dtfi)
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeParse.cs (43)
20internal static DateTime ParseExact(ReadOnlySpan<char> s, ReadOnlySpan<char> format, DateTimeFormatInfo dtfi, DateTimeStyles style)
34internal static DateTime ParseExact(ReadOnlySpan<char> s, ReadOnlySpan<char> format, DateTimeFormatInfo dtfi, DateTimeStyles style, out TimeSpan offset)
50internal static bool TryParseExact(ReadOnlySpan<char> s, ReadOnlySpan<char> format, DateTimeFormatInfo dtfi, DateTimeStyles style, out DateTime result)
61result = DateTime.MinValue;
65internal static bool TryParseExact(ReadOnlySpan<char> s, ReadOnlySpan<char> format, DateTimeFormatInfo dtfi, DateTimeStyles style, out DateTime result, out TimeSpan offset)
78result = DateTime.MinValue;
102internal static DateTime ParseExactMultiple(ReadOnlySpan<char> s, string[] formats,
117internal static DateTime ParseExactMultiple(ReadOnlySpan<char> s, string[] formats,
135DateTimeFormatInfo dtfi, DateTimeStyles style, out DateTime result, out TimeSpan offset)
148result = DateTime.MinValue;
154DateTimeFormatInfo dtfi, DateTimeStyles style, out DateTime result)
165result = DateTime.MinValue;
2423internal static DateTime Parse(ReadOnlySpan<char> s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
2437internal static DateTime Parse(ReadOnlySpan<char> s, DateTimeFormatInfo dtfi, DateTimeStyles styles, out TimeSpan offset)
2453internal static bool TryParse(ReadOnlySpan<char> s, DateTimeFormatInfo dtfi, DateTimeStyles styles, out DateTime result)
2464result = DateTime.MinValue;
2468internal static bool TryParse(ReadOnlySpan<char> s, DateTimeFormatInfo dtfi, DateTimeStyles styles, out DateTime result, out TimeSpan offset)
2481result = DateTime.MinValue;
2688result.Hour, result.Minute, result.Second, 0, result.era, out DateTime time))
2773result.parsedDate = DateTime.SpecifyKind(result.parsedDate, DateTimeKind.Local);
2781result.parsedDate = DateTime.SpecifyKind(result.parsedDate, DateTimeKind.Utc);
2800result.parsedDate = DateTime.SpecifyKind(result.parsedDate, DateTimeKind.Utc);
2838if (utcTicks < DateTime.MinTicks || utcTicks > DateTime.MaxTicks)
2887if (resultTicks < DateTime.MinTicks || resultTicks > DateTime.MaxTicks)
2918resultTicks += tz.GetUtcOffset(bTimeOnly ? DateTime.Now : result.parsedDate, TimeZoneInfoOptions.NoThrowOnInvalidTime).Ticks;
2929if (resultTicks < DateTime.MinTicks || resultTicks > DateTime.MaxTicks)
2938DateTime utcDt = new DateTime(resultTicks, DateTimeKind.Utc);
2942if (resultTicks < DateTime.MinTicks || resultTicks > DateTime.MaxTicks)
2944result.parsedDate = DateTime.MinValue;
3052hour, minute, second, 0, result.era, out DateTime time))
3837private static DateTime GetDateTimeNow(scoped ref DateTimeResult result, scoped ref DateTimeStyles styles)
3842return new DateTime(DateTime.UtcNow.Ticks + result.timeZoneOffset.Ticks, DateTimeKind.Unspecified);
3845return (styles & DateTimeStyles.AssumeUniversal) != 0 ? DateTime.UtcNow : DateTime.Now;
3892DateTime now = GetDateTimeNow(ref result, ref styles);
4965if (!DateTime.TryCreate(year, month, day, hour, minute, second, 0, out result.parsedDate))
5098if (!DateTime.TryCreate(year, month, day, hour, minute, second, 0, out DateTime dateTime))
6106internal DateTime parsedDate;
src\libraries\System.Private.CoreLib\src\System\Globalization\EastAsianLunisolarCalendar.cs (19)
22public virtual int GetSexagenaryYear(DateTime time)
65internal abstract int GetYear(int year, DateTime time);
71internal abstract DateTime MinDate { get; }
72internal abstract DateTime MaxDate { get; }
244public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
398private DateTime LunarToTime(DateTime time, int year, int month, int day)
405private void TimeToLunar(DateTime time, out int year, out int month, out int day)
424public override DateTime AddMonths(DateTime time, int months)
467DateTime dt = LunarToTime(time, y, m, d);
473public override DateTime AddYears(DateTime time, int years)
491DateTime dt = LunarToTime(time, y, m, d);
500public override int GetDayOfYear(DateTime time)
516public override int GetDayOfMonth(DateTime time)
547public override int GetMonth(DateTime time)
560public override int GetYear(DateTime time)
575public override DayOfWeek GetDayOfWeek(DateTime time)
src\libraries\System.Private.CoreLib\src\System\Globalization\GregorianCalendar.cs (21)
31public override DateTime MinSupportedDateTime => DateTime.MinValue;
33public override DateTime MaxSupportedDateTime => DateTime.MaxValue;
137public override DateTime AddMonths(DateTime time, int months)
182public override DateTime AddYears(DateTime time, int years)
191public override int GetDayOfMonth(DateTime time) => time.Day;
199public override DayOfWeek GetDayOfWeek(DateTime time) => time.DayOfWeek;
205public override int GetDayOfYear(DateTime time) => time.DayOfYear;
217return DateTime.DaysInMonth(year, month);
230return DateTime.IsLeapYear(year) ? 366 : 365;
233public override int GetEra(DateTime time) => ADEra;
241public override int GetMonth(DateTime time) => time.Month;
267public override int GetYear(DateTime time) => time.Year;
381return DateTime.IsLeapYear(year);
388public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
398internal override bool TryToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era, out DateTime result)
402result = DateTime.MinValue;
406return DateTime.TryCreate(year, month, day, hour, minute, second, millisecond, out result);
src\libraries\System.Private.CoreLib\src\System\Globalization\GregorianCalendarHelper.cs (13)
206public DateTime AddMonths(DateTime time, int months)
251public DateTime AddYears(DateTime time, int years)
259public int GetDayOfMonth(DateTime time)
270public DayOfWeek GetDayOfWeek(DateTime time)
279public int GetDayOfYear(DateTime time)
315public int GetEra(DateTime time)
346public int GetMonth(DateTime time)
363public int GetYear(DateTime time)
380public int GetYear(int year, DateTime time)
467public DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
475public int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
src\libraries\System.Private.CoreLib\src\System\Globalization\HebrewCalendar.cs (20)
273private static readonly DateTime s_calendarMinValue = new DateTime(1583, 1, 1);
277private static readonly DateTime s_calendarMaxValue = new DateTime((new DateTime(2239, 9, 29, 23, 59, 59, 999)).Ticks + 9999);
279public override DateTime MinSupportedDateTime => s_calendarMinValue;
281public override DateTime MaxSupportedDateTime => s_calendarMaxValue;
445DateTime time = new DateTime(ticks);
526public override DateTime AddMonths(DateTime time, int months)
579public override DateTime AddYears(DateTime time, int years)
605public override int GetDayOfMonth(DateTime time)
610public override DayOfWeek GetDayOfWeek(DateTime time)
624public override int GetDayOfYear(DateTime time)
628DateTime beginOfYearDate;
687public override int GetEra(DateTime time) => HebrewEra;
691public override int GetMonth(DateTime time)
701public override int GetYear(DateTime time)
812private static DateTime HebrewToGregorian(int hebrewYear, int hebrewMonth, int hebrewDay, int hour, int minute, int second, int millisecond)
827DateTime gregorianNewYear = new DateTime(gregorianYear, 1, 1);
831public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
836DateTime dt = HebrewToGregorian(year, month, day, hour, minute, second, millisecond);
src\libraries\System.Private.CoreLib\src\System\Globalization\HijriCalendar.cs (16)
61private static readonly DateTime s_calendarMinValue = new DateTime(622, 7, 18);
62private static readonly DateTime s_calendarMaxValue = DateTime.MaxValue;
64public override DateTime MinSupportedDateTime => s_calendarMinValue;
66public override DateTime MaxSupportedDateTime => s_calendarMaxValue;
267public override DateTime AddMonths(DateTime time, int months)
304public override DateTime AddYears(DateTime time, int years)
309public override int GetDayOfMonth(DateTime time)
314public override DayOfWeek GetDayOfWeek(DateTime time) => time.DayOfWeek;
316public override int GetDayOfYear(DateTime time)
341public override int GetEra(DateTime time)
349public override int GetMonth(DateTime time)
360public override int GetYear(DateTime time)
398public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
src\libraries\System.Private.CoreLib\src\System\Globalization\JapaneseCalendar.cs (16)
35private static readonly DateTime s_calendarMinValue = new DateTime(1868, 9, 8);
37public override DateTime MinSupportedDateTime => s_calendarMinValue;
39public override DateTime MaxSupportedDateTime => DateTime.MaxValue;
103public override DateTime AddMonths(DateTime time, int months)
108public override DateTime AddYears(DateTime time, int years)
123public override int GetDayOfMonth(DateTime time)
128public override DayOfWeek GetDayOfWeek(DateTime time)
133public override int GetDayOfYear(DateTime time)
143public override int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
148public override int GetEra(DateTime time)
153public override int GetMonth(DateTime time)
158public override int GetYear(DateTime time)
184public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
src\libraries\System.Private.CoreLib\src\System\Globalization\KoreanCalendar.cs (16)
37public override DateTime MinSupportedDateTime => DateTime.MinValue;
39public override DateTime MaxSupportedDateTime => DateTime.MaxValue;
60public override DateTime AddMonths(DateTime time, int months)
65public override DateTime AddYears(DateTime time, int years)
80public override int GetDayOfMonth(DateTime time)
85public override DayOfWeek GetDayOfWeek(DateTime time)
90public override int GetDayOfYear(DateTime time)
100public override int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
105public override int GetEra(DateTime time)
110public override int GetMonth(DateTime time)
115public override int GetYear(DateTime time)
140public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
src\libraries\System.Private.CoreLib\src\System\Globalization\PersianCalendar.cs (16)
41private static readonly DateTime s_minDate = new DateTime(622, 3, 22);
42private static readonly DateTime s_maxDate = DateTime.MaxValue;
44public override DateTime MinSupportedDateTime => s_minDate;
46public override DateTime MaxSupportedDateTime => s_maxDate;
219public override DateTime AddMonths(DateTime time, int months)
253public override DateTime AddYears(DateTime time, int years)
258public override int GetDayOfMonth(DateTime time)
263public override DayOfWeek GetDayOfWeek(DateTime time) => time.DayOfWeek;
265public override int GetDayOfYear(DateTime time)
300public override int GetEra(DateTime time)
308public override int GetMonth(DateTime time)
324public override int GetYear(DateTime time)
368public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
src\libraries\System.Private.CoreLib\src\System\Globalization\TaiwanCalendar.cs (16)
36private static readonly DateTime s_calendarMinValue = new DateTime(1912, 1, 1);
38public override DateTime MinSupportedDateTime => s_calendarMinValue;
40public override DateTime MaxSupportedDateTime => DateTime.MaxValue;
60public override DateTime AddMonths(DateTime time, int months)
65public override DateTime AddYears(DateTime time, int years)
80public override int GetDayOfMonth(DateTime time)
85public override DayOfWeek GetDayOfWeek(DateTime time)
90public override int GetDayOfYear(DateTime time)
100public override int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
105public override int GetEra(DateTime time)
110public override int GetMonth(DateTime time)
115public override int GetYear(DateTime time)
140public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
src\libraries\System.Private.CoreLib\src\System\Globalization\ThaiBuddhistCalendar.cs (16)
28public override DateTime MinSupportedDateTime => DateTime.MinValue;
30public override DateTime MaxSupportedDateTime => DateTime.MaxValue;
41public override DateTime AddMonths(DateTime time, int months)
46public override DateTime AddYears(DateTime time, int years)
61public override int GetDayOfMonth(DateTime time)
66public override DayOfWeek GetDayOfWeek(DateTime time)
71public override int GetDayOfYear(DateTime time)
81public override int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
86public override int GetEra(DateTime time)
91public override int GetMonth(DateTime time)
96public override int GetYear(DateTime time)
121public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
src\libraries\System.Private.CoreLib\src\System\Globalization\UmAlQuraCalendar.cs (20)
29internal readonly DateTime GregorianDate;
243private static readonly DateTime s_minDate = new DateTime(1900, 4, 30);
244private static readonly DateTime s_maxDate = new DateTime((new DateTime(2077, 11, 16, 23, 59, 59, 999)).Ticks + 9999);
246public override DateTime MinSupportedDateTime => s_minDate;
248public override DateTime MaxSupportedDateTime => s_maxDate;
273DateTime dt = s_hijriYearInfo[index].GregorianDate;
337private static void ConvertGregorianToHijri(DateTime time, out int HijriYear, out int HijriMonth, out int HijriDay)
382private static int GetDatePart(DateTime time, int part)
410public override DateTime AddMonths(DateTime time, int months)
447DateTime dt = new DateTime(GetAbsoluteDateUmAlQura(y, m, d) * TimeSpan.TicksPerDay + time.Ticks % TimeSpan.TicksPerDay);
452public override DateTime AddYears(DateTime time, int years)
457public override int GetDayOfMonth(DateTime time)
462public override DayOfWeek GetDayOfWeek(DateTime time) => time.DayOfWeek;
464public override int GetDayOfYear(DateTime time)
507public override int GetEra(DateTime time)
515public override int GetMonth(DateTime time)
526public override int GetYear(DateTime time)
569public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
src\libraries\System.Private.CoreLib\src\System\IO\File.cs (37)
175internal static DateTimeOffset GetUtcDateTimeOffset(DateTime dateTime)
183public static void SetCreationTime(string path, DateTime creationTime)
193/// A <see cref="DateTime"/> containing the value to set for the creation date and time of <paramref name="fileHandle"/>.
208public static void SetCreationTime(SafeFileHandle fileHandle, DateTime creationTime)
214public static void SetCreationTimeUtc(string path, DateTime creationTimeUtc)
225/// A <see cref="DateTime"/> containing the value to set for the creation date and time of <paramref name="fileHandle"/>.
240public static void SetCreationTimeUtc(SafeFileHandle fileHandle, DateTime creationTimeUtc)
246public static DateTime GetCreationTime(string path)
256/// A <see cref="DateTime" /> structure set to the creation date and time for the specified file or
265public static DateTime GetCreationTime(SafeFileHandle fileHandle)
271public static DateTime GetCreationTimeUtc(string path)
281/// A <see cref="DateTime" /> structure set to the creation date and time for the specified file or
290public static DateTime GetCreationTimeUtc(SafeFileHandle fileHandle)
296public static void SetLastAccessTime(string path, DateTime lastAccessTime)
306/// A <see cref="DateTime"/> containing the value to set for the last access date and time of <paramref name="fileHandle"/>.
321public static void SetLastAccessTime(SafeFileHandle fileHandle, DateTime lastAccessTime)
327public static void SetLastAccessTimeUtc(string path, DateTime lastAccessTimeUtc)
337/// A <see cref="DateTime"/> containing the value to set for the last access date and time of <paramref name="fileHandle"/>.
352public static void SetLastAccessTimeUtc(SafeFileHandle fileHandle, DateTime lastAccessTimeUtc)
358public static DateTime GetLastAccessTime(string path)
368/// A <see cref="DateTime" /> structure set to the last access date and time for the specified file or
377public static DateTime GetLastAccessTime(SafeFileHandle fileHandle)
383public static DateTime GetLastAccessTimeUtc(string path)
393/// A <see cref="DateTime" /> structure set to the last access date and time for the specified file or
402public static DateTime GetLastAccessTimeUtc(SafeFileHandle fileHandle)
408public static void SetLastWriteTime(string path, DateTime lastWriteTime)
418/// A <see cref="DateTime"/> containing the value to set for the last write date and time of <paramref name="fileHandle"/>.
433public static void SetLastWriteTime(SafeFileHandle fileHandle, DateTime lastWriteTime)
439public static void SetLastWriteTimeUtc(string path, DateTime lastWriteTimeUtc)
449/// A <see cref="DateTime"/> containing the value to set for the last write date and time of <paramref name="fileHandle"/>.
464public static void SetLastWriteTimeUtc(SafeFileHandle fileHandle, DateTime lastWriteTimeUtc)
470public static DateTime GetLastWriteTime(string path)
480/// A <see cref="DateTime" /> structure set to the last write date and time for the specified file or
489public static DateTime GetLastWriteTime(SafeFileHandle fileHandle)
495public static DateTime GetLastWriteTimeUtc(string path)
505/// A <see cref="DateTime" /> structure set to the last write date and time for the specified file or
514public static DateTime GetLastWriteTimeUtc(SafeFileHandle fileHandle)
src\libraries\System.Private.CoreLib\src\System\TimeOnly.cs (7)
47public TimeOnly(int hour, int minute) : this(DateTime.TimeToTicks(hour, minute, 0, 0)) { }
55public TimeOnly(int hour, int minute, int second) : this(DateTime.TimeToTicks(hour, minute, second, 0)) { }
64public TimeOnly(int hour, int minute, int second, int millisecond) : this(DateTime.TimeToTicks(hour, minute, second, millisecond)) { }
74public TimeOnly(int hour, int minute, int second, int millisecond, int microsecond) : this(DateTime.TimeToTicks(hour, minute, second, millisecond, microsecond)) { }
378public static TimeOnly FromDateTime(DateTime dateTime) => new TimeOnly((ulong)dateTime.TimeOfDay.Ticks);
386internal DateTime ToDateTime() => DateTime.CreateUnchecked((long)_ticks);
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.AdjustmentRule.cs (22)
16private readonly DateTime _dateStart;
17private readonly DateTime _dateEnd;
24public DateTime DateStart => _dateStart;
26public DateTime DateEnd => _dateEnd;
47(DaylightTransitionStart != default && DaylightTransitionStart.TimeOfDay != DateTime.MinValue) ||
48(DaylightTransitionEnd != default && DaylightTransitionEnd.TimeOfDay != DateTime.MinValue.AddMilliseconds(1));
68DateTime dateStart,
69DateTime dateEnd,
99DateTime dateStart,
100DateTime dateEnd,
117DateTime dateStart,
118DateTime dateEnd,
134DateTime dateStart,
135DateTime dateEnd,
175DateTime dateStart,
176DateTime dateEnd,
216if (dateStart != DateTime.MinValue && dateStart.Kind == DateTimeKind.Unspecified && dateStart.TimeOfDay != TimeSpan.Zero)
221if (dateEnd != DateTime.MaxValue && dateEnd.Kind == DateTimeKind.Unspecified && dateEnd.TimeOfDay != TimeSpan.Zero)
280_dateStart = (DateTime)info.GetValue("DateStart", typeof(DateTime))!; // Do not rename (binary serialization)
281_dateEnd = (DateTime)info.GetValue("DateEnd", typeof(DateTime))!; // Do not rename (binary serialization)
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.Cache.cs (86)
76internal static long GetLocalDateTimeNowTicks(DateTime utcNow, out bool isAmbiguous) => s_cachedData.GetLocalDateTimeNowTicks(utcNow, out isAmbiguous);
87private DateTimeNowCache GetNextNowTransition(DateTime utcNow)
94dateTimeNowCache._nextUtcNowTransitionTicks = DateTime.MaxTicks;
124DateTime localTransitionStart = SafeCreateDateTimeFromTicks(transition.DateStart.Ticks + transition.Offset.Ticks);
125DateTime localTransitionEnd = SafeCreateDateTimeFromTicks(transition.DateEnd.Ticks + transition.Offset.Ticks);
133DateTime nextLocalTransitionStart = SafeCreateDateTimeFromTicks(nextTransition.DateStart.Ticks + nextTransition.Offset.Ticks);
134DateTime nextLocalTransitionEnd = SafeCreateDateTimeFromTicks(nextTransition.DateEnd.Ticks + nextTransition.Offset.Ticks);
136DateTime overlapStart = localTransitionStart > nextLocalTransitionStart ? localTransitionStart : nextLocalTransitionStart;
137DateTime overlapEnd = localTransitionEnd < nextLocalTransitionEnd ? localTransitionEnd : nextLocalTransitionEnd;
154DateTime prevLocalTransitionStart = SafeCreateDateTimeFromTicks(prevTransition.DateStart.Ticks + prevTransition.Offset.Ticks);
155DateTime prevLocalTransitionEnd = SafeCreateDateTimeFromTicks(prevTransition.DateEnd.Ticks + prevTransition.Offset.Ticks);
157DateTime overlapStart = localTransitionStart > prevLocalTransitionStart ? localTransitionStart : prevLocalTransitionStart;
158DateTime overlapEnd = localTransitionEnd < prevLocalTransitionEnd ? localTransitionEnd : prevLocalTransitionEnd;
180dateTimeNowCache._nextUtcNowTransitionTicks = utcNow.Year >= MaxYear ? DateTime.MaxTicks : new DateTime(utcNow.Year + 1, 1, 1).Ticks; // check again next year
194private bool IsInvalidLocalTime(DateTime localDateTime) => !TryGetUtcOffset(localDateTime, out _);
203private bool IsAmbiguousLocalTime(DateTime localDateTime, Span<TimeSpan> offsets = default)
245private bool IsDaylightSavingOn(DateTime localDateTime)
297private bool TryLocalToUtc(DateTime localDateTime, out DateTime utcDateTime)
316private TimeSpan GetOffsetForUtcDate(DateTime utcDateTime, out bool isDaylightSavingTime)
342private static DateTime SafeCreateDateTimeFromTicks(long ticks, DateTimeKind kind = DateTimeKind.Unspecified)
343=> (ulong)ticks <= DateTime.MaxTicks ? new DateTime(ticks, kind) : (ticks < 0 ? DateTime.MinValue : DateTime.MaxValue);
352private TimeSpan GetOffsetForUtcDate(DateTime utcDateTime, out bool isDaylightSavingTime, out bool isAmbiguous)
355DateTime localTime = SafeCreateDateTimeFromTicks(utcDateTime.Ticks + offset.Ticks);
368private DateTime UtcToLocal(DateTime utcDateTime, out bool isDaylightSavingTime)
384private bool TryGetUtcOffset(DateTime localDateTime, out TimeSpan offset)
543private static DateTime StartTransitionTimeToDateTime(int year, AdjustmentRule rule)
554private static DateTime EndTransitionTimeToDateTime(int year, AdjustmentRule rule)
556year >= MaxYear ? DateTime.MaxValue : new DateTime(year + 1, 1, 1, 0, 0, 0, DateTimeKind.Unspecified) :
562internal static DateTime TransitionTimeToDateTime(int year, TransitionTime transitionTime)
564DateTime value;
575int daysInMonth = DateTime.DaysInMonth(year, transitionTime.Month);
611int daysInMonth = DateTime.DaysInMonth(year, transitionTime.Month);
663DateTime startOfYear = new DateTime(year, 1, 1);
681DateTime previousYearTransitionEnd = SafeCreateDateTimeFromTicks(previousRule.DateEnd.Ticks + 1); // UTC coordinate
701DateTime previousYearStart = StartTransitionTimeToDateTime(year - 1, previousRule); // Local coordinate
702DateTime previousYearEnd = EndTransitionTimeToDateTime(year - 1, previousRule); // Local coordinate
711DateTime previousYearEndUtc = GetUtcDateTimeFromLocalTicks(previousYearEnd.Ticks, previousRule, includeDaylightDelta: true, tickAdjustment: -1);
737DateTime previousEndOfYearUtc = SafeCreateDateTimeFromTicks(previousEndOfYearUtcTicks, DateTimeKind.Utc);
747DateTime previousYearStartUtc = GetUtcDateTimeFromLocalTicks(previousYearStart.Ticks, previousRule); // daylight offset is not counted in this start
757DateTime transitionStart = new DateTime(year > 1 ? year - 1 : 1, 1, 1);
779DateTime endOfCurrentYear = year < MaxYear ? new DateTime(year + 1, 1, 1).AddTicks(-1) : DateTime.MaxValue;
810DateTime nextYearStart = StartTransitionTimeToDateTime(nextYear, nextRule); // in local time
811DateTime nextYearEnd = EndTransitionTimeToDateTime(nextYear, nextRule); // in local time
820DateTime nextYearStartUtc = GetUtcDateTimeFromLocalTicks(nextYearStart.Ticks, nextRule);
843DateTime nextYearEndUtc = GetUtcDateTimeFromLocalTicks(nextYearEnd.Ticks, nextRule, includeDaylightDelta: true, tickAdjustment: -1);
844DateTime nextBeginningOfYearUtc = GetUtcDateTimeFromLocalTicks(new DateTime(year + 1, 1, 1).Ticks, nextRule, includeDaylightDelta: true);
886DateTime endOfNextYear = year + 1 < MaxYear ? new DateTime(year + 2, 1, 1).AddTicks(-1) : DateTime.MaxValue;
905DateTime localStart = StartTransitionTimeToDateTime(year, rule); // Local time
906DateTime localEnd = EndTransitionTimeToDateTime(year, rule); // Local time
910DateTime utcStart = GetUtcDateTimeFromLocalTicks(localStart.Ticks, rule, includeDaylightDelta: startWithDaylightOn, kind: DateTimeKind.Utc);
911DateTime utcEnd = GetUtcDateTimeFromLocalTicks(localEnd.Ticks, rule, includeDaylightDelta: true, tickAdjustment: -1, kind: DateTimeKind.Utc);
914DateTime startOfCurrentYearUtc = SafeCreateDateTimeFromTicks(startOfCurrentYearUtcTicks, DateTimeKind.Utc);
915DateTime currentYearStart = new DateTime(year, 1, 1);
945DateTime previousYearTransitionEnd = SafeCreateDateTimeFromTicks(previousRule.DateEnd.Ticks + 1); // UTC coordinate
965DateTime previousYearStart = StartTransitionTimeToDateTime(year - 1, previousRule); // Local time
966DateTime previousYearEnd = EndTransitionTimeToDateTime(year - 1, previousRule); // Local time
975DateTime previousYearEndUtc = GetUtcDateTimeFromLocalTicks(previousYearEnd.Ticks, previousRule, includeDaylightDelta: true);
999DateTime previousYearStartUtc = GetUtcDateTimeFromLocalTicks(previousYearStart.Ticks, previousRule); // daylight offset is not counted in this start
1012DateTime previousYearStart = new DateTime(year > 1 ? year - 1 : 1, 1, 1); // real Utc year start
1039DateTime endOfCurrentYear = year < MaxYear ? new DateTime(year + 1, 1, 1).AddTicks(-1) : DateTime.MaxValue;
1041DateTime endOfCurrentYearUtc = SafeCreateDateTimeFromTicks(endOfCurrentYearUtcTicks, DateTimeKind.Utc);
1081DateTime nextYearStart = StartTransitionTimeToDateTime(year + 1, nextRule); // Local time
1082DateTime nextYearEnd = EndTransitionTimeToDateTime(year + 1, nextRule); // Local time
1084DateTime nextYearStartUtc = GetUtcDateTimeFromLocalTicks(nextYearStart.Ticks, nextRule, includeDaylightDelta: nextRule.IsStartDateMarkerForBeginningOfYear());
1085DateTime nextYearEndUtc = GetUtcDateTimeFromLocalTicks(nextYearEnd.Ticks, nextRule, includeDaylightDelta: true, tickAdjustment: -1);
1165DateTime previousYearStart = StartTransitionTimeToDateTime(year - 1, previousRule); // Local time
1166DateTime previousYearEnd = EndTransitionTimeToDateTime(year - 1, previousRule); // Local time
1167DateTime previousYearStartUtc = GetUtcDateTimeFromLocalTicks(previousYearStart.Ticks, previousRule, includeDaylightDelta: previousRule.IsStartDateMarkerForBeginningOfYear());
1175DateTime previousYearEndUtc = GetUtcDateTimeFromLocalTicks(previousYearEnd.Ticks, previousRule, includeDaylightDelta: true, tickAdjustment: -1);
1223DateTime endOfCurrentYear = year < MaxYear ? new DateTime(year + 1, 1, 1).AddTicks(-1) : DateTime.MaxValue;
1225DateTime endOfCurrentYearUtc = SafeCreateDateTimeFromTicks(endOfCurrentYearUtcTicks, DateTimeKind.Utc);
1283DateTime nextYearStart = StartTransitionTimeToDateTime(year + 1, nextRule); // in local time
1284DateTime nextYearEnd = EndTransitionTimeToDateTime(year + 1, nextRule); // in local time
1286DateTime nextYearStartUtc = GetUtcDateTimeFromLocalTicks(nextYearStart.Ticks, nextRule, includeDaylightDelta: nextRule.IsStartDateMarkerForBeginningOfYear());
1287DateTime nextYearEndUtc = GetUtcDateTimeFromLocalTicks(nextYearEnd.Ticks, nextRule, includeDaylightDelta: true, tickAdjustment: -1);
1383private DateTime GetUtcDateTimeFromLocalTicks(long localTicks, AdjustmentRule rule, bool includeDaylightDelta = false, long tickAdjustment = 0, DateTimeKind kind = DateTimeKind.Utc) =>
1407DateTime DateStart, // UTC
1408DateTime DateEnd, // UTC
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.cs (58)
135internal long GetLocalDateTimeNowTicks(DateTime utcNow, out bool isAmbiguous)
224public TimeSpan[] GetAmbiguousTimeOffsets(DateTime dateTime)
231DateTime adjustedTime;
265public TimeSpan GetUtcOffset(DateTime dateTime) =>
269internal static TimeSpan GetLocalUtcOffset(DateTime dateTime, TimeZoneInfoOptions flags)
278internal TimeSpan GetUtcOffset(DateTime dateTime, TimeZoneInfoOptions flags) =>
281private TimeSpan GetUtcOffset(DateTime dateTime, TimeZoneInfoOptions flags, CachedData cachedData)
290DateTime adjustedTime = ConvertTime(dateTime, cachedData.Local, s_utcTimeZone, flags);
347public bool IsAmbiguousTime(DateTime dateTime) =>
354internal bool IsAmbiguousTime(DateTime dateTime, TimeZoneInfoOptions flags)
362DateTime adjustedTime =
382public bool IsDaylightSavingTime(DateTime dateTime) =>
388internal bool IsDaylightSavingTime(DateTime dateTime, TimeZoneInfoOptions flags) =>
391private bool IsDaylightSavingTime(DateTime dateTime, TimeZoneInfoOptions flags, CachedData cachedData)
411DateTime adjustedTime;
447public bool IsInvalidTime(DateTime dateTime)
469public static DateTime ConvertTimeBySystemTimeZoneId(DateTime dateTime, string destinationTimeZoneId) =>
559public static DateTime ConvertTimeBySystemTimeZoneId(DateTime dateTime, string sourceTimeZoneId, string destinationTimeZoneId)
589DateTime utcDateTime = dateTimeOffset.UtcDateTime;
596ticks > DateTime.MaxTicks ? DateTimeOffset.MaxValue :
597ticks < DateTime.MinTicks ? DateTimeOffset.MinValue :
604public static DateTime ConvertTime(DateTime dateTime, TimeZoneInfo destinationTimeZone)
621public static DateTime ConvertTime(DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone) =>
627internal static DateTime ConvertTime(DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone, TimeZoneInfoOptions flags) =>
630private static DateTime ConvertTime(DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone, TimeZoneInfoOptions flags, CachedData cachedData)
641bool isInvalidTime = !sourceTimeZone.TryLocalToUtc(dateTime, out DateTime utcDateTime);
663DateTime targetConverted = destinationTimeZone.UtcToLocal(utcDateTime, out bool isDaylightSaving);
680public static DateTime ConvertTimeFromUtc(DateTime dateTime, TimeZoneInfo destinationTimeZone) =>
686public static DateTime ConvertTimeToUtc(DateTime dateTime)
699internal static DateTime ConvertTimeToUtc(DateTime dateTime, TimeZoneInfoOptions flags)
709public static DateTime ConvertTimeToUtc(DateTime dateTime, TimeZoneInfo sourceTimeZone) =>
1038DateTime dateTime, DateTime dateOnly, bool dateTimeIsUtc)
1043DateTime dateTimeToCompare = dateTimeIsUtc ?
1065DateTime dateTimeToCompare = dateTimeIsUtc ?
1083private DateTime ConvertToUtc(DateTime dateTime, TimeSpan daylightDelta, TimeSpan baseUtcOffsetDelta) =>
1089private DateTime ConvertFromUtc(DateTime dateTime, TimeSpan daylightDelta, TimeSpan baseUtcOffsetDelta) =>
1095private DateTime ConvertToFromUtc(DateTime dateTime, TimeSpan daylightDelta, TimeSpan baseUtcOffsetDelta, bool convertToUtc)
1106ticks > DateTime.MaxTicks ? DateTime.MaxValue :
1107ticks < DateTime.MinTicks ? DateTime.MinValue :
1115private static TimeSpan GetUtcOffsetFromUtc(DateTime time, TimeZoneInfo zone) =>
1122private static TimeSpan GetUtcOffsetFromUtc(DateTime time, TimeZoneInfo zone, out bool isDaylightSavings) =>
1129internal static TimeSpan GetUtcOffsetFromUtc(DateTime time, TimeZoneInfo zone, out bool isDaylightSavings, out bool isAmbiguousLocalDst)
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.TransitionTime.cs (8)
14private readonly DateTime _timeOfDay;
21public DateTime TimeOfDay => _timeOfDay;
50private TransitionTime(DateTime timeOfDay, int month, int week, int day, DayOfWeek dayOfWeek, bool isFixedDateRule)
62public static TransitionTime CreateFixedDateRule(DateTime timeOfDay, int month, int day) =>
65public static TransitionTime CreateFloatingDateRule(DateTime timeOfDay, int month, int week, DayOfWeek dayOfWeek) =>
71private static void ValidateTransitionTime(DateTime timeOfDay, int month, int week, int day, DayOfWeek dayOfWeek)
145_timeOfDay = (DateTime)info.GetValue("TimeOfDay", typeof(DateTime))!; // Do not rename (binary serialization)
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.Unix.cs (31)
69DateTime[] dts;
81DateTime utcNow = DateTime.UtcNow;
136private static readonly TransitionTime s_daylightRuleMarker = TransitionTime.CreateFixedDateRule(DateTime.MinValue.AddMilliseconds(2), 1, 1);
139private static DateTime GetTimeOnlyInMillisecondsPrecision(DateTime input) => new DateTime((input.TimeOfDay.Ticks / TimeSpan.TicksPerMillisecond) * TimeSpan.TicksPerMillisecond);
169DateTime start = rule.DateStart.Kind == DateTimeKind.Utc ?
174DateTime end = rule.DateEnd.Kind == DateTimeKind.Utc ?
200DateTime endForFirstRule = new DateTime(start.Year + 1, 1, 1).AddMilliseconds(-1); // At the end of the first year
209DateTime middleYearStart = new DateTime(start.Year + 1, 1, 1);
210DateTime middleYearEnd = new DateTime(end.Year, 1, 1).AddMilliseconds(-1);
217DateTime endYearStart = new DateTime(end.Year, 1, 1); // At the beginning of the last year
486private static void TZif_GenerateAdjustmentRules(out AdjustmentRule[]? rules, TimeSpan baseUtcOffset, DateTime[] dts, byte[] typeOfLocalTime,
509private static void TZif_GenerateAdjustmentRule(ref int index, TimeSpan timeZoneBaseUtcOffset, List<AdjustmentRule> rulesList, DateTime[] dts,
529while (index < dts.Length && dts[index] == DateTime.MinValue)
537DateTime endTransitionDate = dts[index];
544DateTime.MinValue,
561DateTime startTransitionDate = dts[index - 1];
564DateTime endTransitionDate = dts[index];
607DateTime startTransitionDate = dts[index - 1];
624DateTime.MaxValue,
692private static AdjustmentRule? TZif_CreateAdjustmentRuleForPosixFormat(string posixFormat, DateTime startTransitionDate, TimeSpan timeZoneBaseUtcOffset)
739DateTime.MaxValue,
751DateTime.MaxValue,
802private static DateTime ParseTimeOfDay(ReadOnlySpan<char> time)
804DateTime timeOfDay;
1131private static DateTime TZif_UnixTimeToDateTime(long unixTime) =>
1132unixTime < DateTimeOffset.UnixMinSeconds ? DateTime.MinValue :
1133unixTime > DateTimeOffset.UnixMaxSeconds ? DateTime.MaxValue :
1136private static void TZif_ParseRaw(byte[] data, out DateTime[] dts, out byte[] typeOfLocalTime, out TZifType[] transitionType,
1160dts = new DateTime[t.TimeCount];
System.Private.DataContractSerialization (108)
System\Runtime\Serialization\Json\JsonReaderDelegator.cs (12)
116internal override DateTime ReadContentAsDateTime()
121internal static DateTime ParseJsonDate(string originalDateTimeValue, DateTimeFormat? dateTimeFormat)
129return DateTime.ParseExact(originalDateTimeValue, dateTimeFormat.FormatString, dateTimeFormat.FormatProvider, dateTimeFormat.DateTimeStyles);
133internal static DateTime ParseJsonDateInDefaultFormat(string originalDateTimeValue)
186DateTime dateTime = new DateTime(ticks, DateTimeKind.Utc);
192return DateTime.SpecifyKind(dateTime.ToLocalTime(), DateTimeKind.Unspecified);
204internal override DateTime ReadElementContentAsDateTime()
211int arrayLength, [NotNullWhen(true)] out DateTime[]? array)
218int arrayLength, [NotNullWhen(true)] out DateTime[]? array)
232private sealed class DateTimeArrayJsonHelperWithString : ArrayHelper<string, DateTime>
241protected override int ReadArray(XmlDictionaryReader reader, string localName, string namespaceUri, DateTime[] array, int offset, int count)
253protected override void WriteArray(XmlDictionaryWriter writer, string prefix, string localName, string namespaceUri, DateTime[] array, int offset, int count)
System\Runtime\Serialization\Json\XmlJsonWriter.cs (5)
291public override void WriteArray(string? prefix, string localName, string? namespaceUri, DateTime[] array, int offset, int count)
341public override void WriteArray(string? prefix, XmlDictionaryString localName, XmlDictionaryString? namespaceUri, DateTime[] array, int offset, int count)
1002public override void WriteValue(DateTime value)
1402else if (value is DateTime)
1404WriteValue((DateTime)value);
System\Xml\ArrayHelper.cs (6)
311internal sealed class DateTimeArrayHelperWithString : ArrayHelper<string, DateTime>
315protected override int ReadArray(XmlDictionaryReader reader, string localName, string namespaceUri, DateTime[] array, int offset, int count)
320protected override void WriteArray(XmlDictionaryWriter writer, string prefix, string localName, string namespaceUri, DateTime[] array, int offset, int count)
326internal sealed class DateTimeArrayHelperWithDictionaryString : ArrayHelper<XmlDictionaryString, DateTime>
330protected override int ReadArray(XmlDictionaryReader reader, XmlDictionaryString localName, XmlDictionaryString namespaceUri, DateTime[] array, int offset, int count)
335protected override void WriteArray(XmlDictionaryWriter writer, string prefix, XmlDictionaryString localName, XmlDictionaryString namespaceUri, DateTime[] array, int offset, int count)
System\Xml\XmlBinaryReader.cs (7)
236public override DateTime ReadElementContentAsDateTime()
243DateTime value = BufferReader.ReadDateTime();
1187type = typeof(DateTime);
1399private int ReadArray(DateTime[] array, int offset, int count)
1405foreach (ref DateTime item in array.AsSpan(offset, actual))
1413public override int ReadArray(string localName, string namespaceUri, DateTime[] array, int offset, int count)
1420public override int ReadArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri, DateTime[] array, int offset, int count)
System\Xml\XmlDictionaryAsyncCheckWriter.cs (2)
652public override void WriteArray(string? prefix, string localName, string? namespaceUri, DateTime[] array, int offset, int count)
658public override void WriteArray(string? prefix, XmlDictionaryString localName, XmlDictionaryString? namespaceUri, DateTime[] array, int offset, int count)
System\Xml\XmlDictionaryReader.cs (8)
824public override DateTime ReadElementContentAsDateTime()
827DateTime value;
834value = DateTime.Parse(string.Empty, NumberFormatInfo.InvariantInfo);
1229public virtual DateTime[] ReadDateTimeArray(string localName, string namespaceUri)
1234public virtual DateTime[] ReadDateTimeArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri)
1239public virtual int ReadArray(string localName, string namespaceUri, DateTime[] array, int offset, int count)
1251public virtual int ReadArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri, DateTime[] array, int offset, int count)
1671public override DateTime ReadContentAsDateTime()
System\Xml\XmlDictionaryWriter.cs (4)
306else if (type == typeof(DateTime))
335else if (type == typeof(DateTime))
568public virtual void WriteArray(string? prefix, string localName, string? namespaceUri, DateTime[] array, int offset, int count)
579public virtual void WriteArray(string? prefix, XmlDictionaryString localName, XmlDictionaryString? namespaceUri, DateTime[] array, int offset, int count)
System.Private.Windows.Core (68)
System\Private\Windows\BinaryFormat\BinaryFormatWriter.cs (10)
75/// Writes a <see cref="DateTime"/> in binary format.
77public static void WriteDateTime(Stream stream, DateTime value)
85new ClassInfo(1, typeof(DateTime).FullName!, s_dateTimeMemberNames),
92Unsafe.As<DateTime, ulong>(ref value)).Write(writer);
323WriteDateTime(stream, (DateTime)primitive);
448case List<DateTime> typedList:
551PrimitiveType.DateTime => new ArraySinglePrimitive<DateTime>(
5521, new ListConverter<object, DateTime>(array, o => (DateTime)o!)),
696case DateTime dateTime:
System.Private.Windows.Core.Tests (56)
System\Private\Windows\Ole\BinaryFormatUtilitiesTests.cs (18)
47DateTime.Now,
80new List<DateTime> { DateTime.MinValue, DateTime.MaxValue },
100new DateTime[] { DateTime.MinValue, DateTime.MaxValue },
122(ArrayList)([DateTime.MinValue, DateTime.MaxValue]),
142new Hashtable { { "DateTime", DateTime.Now } },
746(typeof(DateTime?).FullName!, typeof(DateTime?)),
983public DateTime? Today = DateTime.Now;
1000public DateTime[] DateTimeArray = [DateTime.Now];
1024public List<DateTime> DateTimes = [DateTime.Now];
System\Value\StoringDateTime.cs (33)
8public static TheoryData<DateTime> DateTimeData => new()
10{ DateTime.Now },
11{ DateTime.UtcNow },
12{ DateTime.MaxValue },
13{ DateTime.MinValue }
18public void DateTimeImplicit(DateTime @DateTime)
21Assert.Equal(@DateTime, value.GetValue<DateTime>());
22Assert.Equal(typeof(DateTime), value.Type);
24DateTime? source = @DateTime;
26Assert.Equal(source, value.GetValue<DateTime?>());
27Assert.Equal(typeof(DateTime), value.Type);
32public void DateTimeInOut(DateTime @DateTime)
35bool success = value.TryGetValue(out DateTime result);
39Assert.Equal(@DateTime, value.GetValue<DateTime>());
40Assert.Equal(@DateTime, (DateTime)value);
45public void NullableDateTimeInDateTimeOut(DateTime @DateTime)
47DateTime? source = @DateTime;
50bool success = value.TryGetValue(out DateTime result);
54Assert.Equal(@DateTime, value.GetValue<DateTime>());
56Assert.Equal(@DateTime, (DateTime)value);
61public void DateTimeInNullableDateTimeOut(DateTime @DateTime)
63DateTime source = @DateTime;
65bool success = value.TryGetValue(out DateTime? result);
69Assert.Equal(@DateTime, (DateTime?)value);
75DateTime? source = null;
78Assert.Equal(source, value.GetValue<DateTime?>());
79Assert.False(value.GetValue<DateTime?>().HasValue);
84public void OutAsObject(DateTime @DateTime)
88Assert.Equal(typeof(DateTime), o.GetType());
89Assert.Equal(@DateTime, (DateTime)o);
91DateTime? n = @DateTime;
94Assert.Equal(typeof(DateTime), o.GetType());
95Assert.Equal(@DateTime, (DateTime)o);
System.Private.Xml (290)
System\Xml\BinaryXml\SqlUtils.cs (21)
513public static DateTime XsdDateTimeToDateTime(long val)
540public static DateTime XsdDateToDateTime(long val)
549DateTime d = new DateTime(yr, mnth, day, 0, 0, 0, DateTimeKind.Utc);
567public static DateTime XsdTimeToDateTime(long val)
579DateTime dateTime = SqlDateTimeToDateTime(dateticks, timeticks);
583public static DateTime SqlDateTimeToDateTime(int dateticks, uint timeticks)
585DateTime SQLBaseDate = new DateTime(1900, 1, 1);
601DateTime dateTime = SqlSmallDateTimeToDateTime(dateticks, timeticks);
604public static DateTime SqlSmallDateTimeToDateTime(short dateticks, ushort timeticks)
610public static DateTime XsdKatmaiDateToDateTime(byte[] data, int offset)
614DateTime dt = new DateTime(dateTicks);
618public static DateTime XsdKatmaiDateTimeToDateTime(byte[] data, int offset)
623DateTime dt = new DateTime(dateTicks + timeTicks);
627public static DateTime XsdKatmaiTimeToDateTime(byte[] data, int offset)
633public static DateTime XsdKatmaiDateOffsetToDateTime(byte[] data, int offset)
639public static DateTime XsdKatmaiDateTimeOffsetToDateTime(byte[] data, int offset)
645public static DateTime XsdKatmaiTimeOffsetToDateTime(byte[] data, int offset)
677DateTime dt = XsdKatmaiDateToDateTime(data, offset);
685DateTime dt = XsdKatmaiDateTimeToDateTime(data, offset);
695DateTime dt = XsdKatmaiTimeToDateTime(data, offset);
773private static int GetFractions(DateTime dt)
System\Xml\Schema\XmlValueConverter.cs (102)
161public abstract bool ToBoolean(DateTime value);
168public abstract int ToInt32(DateTime value);
175public abstract long ToInt64(DateTime value);
184public abstract double ToDouble(DateTime value);
191public abstract DateTime ToDateTime(bool value);
192public abstract DateTime ToDateTime(int value);
193public abstract DateTime ToDateTime(long value);
194public abstract DateTime ToDateTime(double value);
195public abstract DateTime ToDateTime(DateTimeOffset value);
196public abstract DateTime ToDateTime(string value);
197public abstract DateTime ToDateTime(object value);
198public abstract DateTimeOffset ToDateTimeOffset(DateTime value);
208public abstract string ToString(DateTime value);
218public abstract object ChangeType(DateTime value, Type destinationType);
321protected static readonly Type DateTimeType = typeof(DateTime);
329public override bool ToBoolean(DateTime value) { return (bool)ChangeType((object)value, BooleanType, null); }
336public override DateTime ToDateTime(bool value) { return (DateTime)ChangeType((object)value, DateTimeType, null); }
337public override DateTime ToDateTime(DateTimeOffset value) { return (DateTime)ChangeType((object)value, DateTimeType, null); }
338public override DateTime ToDateTime(double value) { return (DateTime)ChangeType((object)value, DateTimeType, null); }
339public override DateTime ToDateTime(int value) { return (DateTime)ChangeType((object)value, DateTimeType, null); }
340public override DateTime ToDateTime(long value) { return (DateTime)ChangeType((object)value, DateTimeType, null); }
341public override DateTime ToDateTime(string value) { return (DateTime)ChangeType((object)value, DateTimeType, null); }
342public override DateTime ToDateTime(object value) { return (DateTime)ChangeType((object)value, DateTimeType, null); }
343public override DateTimeOffset ToDateTimeOffset(DateTime value) { return (DateTimeOffset)ChangeType((object)value, DateTimeOffsetType, null); }
350public override double ToDouble(DateTime value) { return (double)ChangeType((object)value, DoubleType, null); }
357public override int ToInt32(DateTime value) { return (int)ChangeType((object)value, Int32Type, null); }
364public override long ToInt64(DateTime value) { return (long)ChangeType((object)value, Int64Type, null); }
374public override string ToString(DateTime value) { return (string)ChangeType((object)value, StringType, null); }
385public override object ChangeType(DateTime value, Type destinationType) { return (object)ChangeType((object)value, destinationType, null); }
527protected static DateTime StringToDate(string value)
529return (DateTime)(new XsdDateTime(value, XsdDateTimeFlags.Date));
532protected static DateTime StringToDateTime(string value)
534return (DateTime)(new XsdDateTime(value, XsdDateTimeFlags.DateTime));
548protected static DateTime StringToGDay(string value)
550return (DateTime)(new XsdDateTime(value, XsdDateTimeFlags.GDay));
553protected static DateTime StringToGMonth(string value)
555return (DateTime)(new XsdDateTime(value, XsdDateTimeFlags.GMonth));
558protected static DateTime StringToGMonthDay(string value)
560return (DateTime)(new XsdDateTime(value, XsdDateTimeFlags.GMonthDay));
563protected static DateTime StringToGYear(string value)
565return (DateTime)(new XsdDateTime(value, XsdDateTimeFlags.GYear));
568protected static DateTime StringToGYearMonth(string value)
570return (DateTime)(new XsdDateTime(value, XsdDateTimeFlags.GYearMonth));
650protected static DateTime StringToTime(string value)
652return (DateTime)(new XsdDateTime(value, XsdDateTimeFlags.Time));
681protected static string DateToString(DateTime value)
686protected static string DateTimeToString(DateTime value)
701protected static string GDayToString(DateTime value)
706protected static string GMonthToString(DateTime value)
711protected static string GMonthDayToString(DateTime value)
716protected static string GYearToString(DateTime value)
721protected static string GYearMonthToString(DateTime value)
775protected static string TimeToString(DateTime value)
795internal static DateTime DateTimeOffsetToDateTime(DateTimeOffset value)
872protected static DateTime UntypedAtomicToDateTime(string value)
874return (DateTime)(new XsdDateTime(value, XsdDateTimeFlags.AllXsd));
1333public override DateTime ToDateTime(DateTimeOffset value)
1338public override DateTime ToDateTime(string value)
1354public override DateTime ToDateTime(object value)
1360if (sourceType == DateTimeType) return ((DateTime)value);
1365return (DateTime)ChangeListType(value, DateTimeType, null);
1372public override DateTimeOffset ToDateTimeOffset(DateTime value)
1400if (sourceType == DateTimeType) return ToDateTimeOffset((DateTime)value);
1447public override string ToString(DateTime value) =>
1450XmlTypeCode.Date => DateToString((DateTime)value),
1451XmlTypeCode.Time => TimeToString((DateTime)value),
1452XmlTypeCode.GDay => GDayToString((DateTime)value),
1453XmlTypeCode.GMonth => GMonthToString((DateTime)value),
1454XmlTypeCode.GMonthDay => GMonthDayToString((DateTime)value),
1455XmlTypeCode.GYear => GYearToString((DateTime)value),
1456XmlTypeCode.GYearMonth => GYearMonthToString((DateTime)value),
1457_ => DateTimeToString((DateTime)value),
1479if (sourceType == DateTimeType) return this.ToString((DateTime)value);
1492public override object ChangeType(DateTime value, Type destinationType)
1497if (destinationType == DateTimeType) return ((DateTime)value);
1498if (destinationType == DateTimeOffsetType) return this.ToDateTimeOffset((DateTime)value);
1499if (destinationType == StringType) return this.ToString((DateTime)value);
1500if (destinationType == XmlAtomicValueType) return (new XmlAtomicValue(SchemaType!, (DateTime)value));
1501if (destinationType == XPathItemType) return (new XmlAtomicValue(SchemaType!, (DateTime)value));
1534if (sourceType == DateTimeType) return (new XmlAtomicValue(SchemaType!, (DateTime)value));
1541if (sourceType == DateTimeType) return (new XmlAtomicValue(SchemaType!, (DateTime)value));
2048public override DateTime ToDateTime(string value)
2054public override DateTime ToDateTime(object value)
2062return (DateTime)ChangeTypeWildcardDestination(value, DateTimeType, null);
2205public override string ToString(DateTime value)
2207return DateTimeToString((DateTime)value);
2242if (sourceType == DateTimeType) return DateTimeToString((DateTime)value);
2278public override object ChangeType(DateTime value, Type destinationType)
2283if (destinationType == StringType) return DateTimeToString((DateTime)value);
2560public override DateTime ToDateTime(object value)
2568return (DateTime)ChangeTypeWildcardDestination(value, DateTimeType, null);
2688public override object ChangeType(DateTime value, Type destinationType)
2693if (destinationType == XmlAtomicValueType) return (new XmlAtomicValue(XmlSchemaType.GetBuiltInSimpleType(XmlTypeCode.DateTime), (DateTime)value));
2795if (sourceType == DateTimeType) return (new XmlAtomicValue(XmlSchemaType.GetBuiltInSimpleType(XmlTypeCode.DateTime), (DateTime)value));
2985if (itemTypeDst == DateTimeType) return ToArray<DateTime>(value, nsResolver);
System\Xml\Schema\XsdDateTime.cs (21)
40private DateTime _dt;
168public XsdDateTime(DateTime dateTime, XsdDateTimeFlags kinds)
351public DateTime ToZulu() =>
382public static implicit operator DateTime(XsdDateTime xdt)
384DateTime result;
390result = new DateTime(DateTime.Now.Year, xdt.Month, xdt.Day);
394DateTime currentDateTime = DateTime.Now;
413if (ticks < DateTime.MinValue.Ticks)
417if (ticks < DateTime.MinValue.Ticks)
418ticks = DateTime.MinValue.Ticks;
426if (ticks > DateTime.MaxValue.Ticks)
430if (ticks > DateTime.MaxValue.Ticks)
431ticks = DateTime.MaxValue.Ticks;
444DateTime dt;
450dt = new DateTime(DateTime.Now.Year, xdt.Month, xdt.Day);
454DateTime currentDateTime = DateTime.Now;
839Parse2Dig(start + s_lz__mm_, ref day) && 1 <= day && day <= DateTime.DaysInMonth(leapYear, month) &&
866Parse2Dig(start + s_Lz___, ref day) && 1 <= day && day <= DateTime.DaysInMonth(leapYear, firstMonth) &&
888Parse2Dig(start + s_lzyyyy_MM_, ref day) && 1 <= day && day <= DateTime.DaysInMonth(year, month);
System\Xml\Serialization\Types.cs (6)
505AddPrimitive(typeof(DateTime), "dateTime", "DateTime", TypeFlags.CanBeAttributeValue | TypeFlags.CanBeElementValue | TypeFlags.HasCustomFormatter | TypeFlags.XmlEncodingNotRequired);
514AddPrimitive(typeof(DateTime), "date", "Date", TypeFlags.AmbiguousDataType | TypeFlags.CanBeAttributeValue | TypeFlags.CanBeElementValue | TypeFlags.HasCustomFormatter | TypeFlags.XmlEncodingNotRequired);
515AddPrimitive(typeof(DateTime), "time", "Time", TypeFlags.AmbiguousDataType | TypeFlags.CanBeAttributeValue | TypeFlags.CanBeElementValue | TypeFlags.HasCustomFormatter | TypeFlags.XmlEncodingNotRequired);
618AddSoapEncodedPrimitive(typeof(DateTime), "dateTime", ns, "DateTime", new XmlQualifiedName("string", XmlSchema.Namespace), TypeFlags.CanBeAttributeValue | TypeFlags.CanBeElementValue | TypeFlags.HasCustomFormatter | TypeFlags.XmlEncodingNotRequired);
627AddSoapEncodedPrimitive(typeof(DateTime), "date", ns, "Date", new XmlQualifiedName("string", XmlSchema.Namespace), TypeFlags.AmbiguousDataType | TypeFlags.CanBeAttributeValue | TypeFlags.CanBeElementValue | TypeFlags.HasCustomFormatter | TypeFlags.XmlEncodingNotRequired);
628AddSoapEncodedPrimitive(typeof(DateTime), "time", ns, "Time", new XmlQualifiedName("string", XmlSchema.Namespace), TypeFlags.AmbiguousDataType | TypeFlags.CanBeAttributeValue | TypeFlags.CanBeElementValue | TypeFlags.HasCustomFormatter | TypeFlags.XmlEncodingNotRequired);
System\Xml\Serialization\Xmlcustomformatter.cs (16)
41if (type == typeof(DateTime))
45return FromDateTime((DateTime)value);
49return FromDate((DateTime)value);
53return FromTime((DateTime)value);
78internal static string FromDate(DateTime value)
88internal static string FromTime(DateTime value)
92return XmlConvert.ToString(DateTime.MinValue + value.TimeOfDay, "HH:mm:ss.fffffffZ");
96return XmlConvert.ToString(DateTime.MinValue + value.TimeOfDay, "HH:mm:ss.fffffffzzzzzz");
107internal static string FromDateTime(DateTime value)
120internal static bool TryFormatDateTime(DateTime value, Span<char> destination, out int charsWritten)
395internal static DateTime ToDateTime(string value)
408internal static DateTime ToDateTime(string value, string[] formats)
413internal static DateTime ToDate(string value)
423internal static DateTime ToTime(string value)
427return DateTime.ParseExact(value, s_allTimeFormats, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AllowLeadingWhite | DateTimeStyles.AllowTrailingWhite | DateTimeStyles.NoCurrentDateDefault | DateTimeStyles.RoundtripKind);
431return DateTime.ParseExact(value, s_allTimeFormats, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AllowLeadingWhite | DateTimeStyles.AllowTrailingWhite | DateTimeStyles.NoCurrentDateDefault);
System\Xml\XmlConvert.cs (18)
692public static string ToString(DateTime value)
697public static string ToString(DateTime value, [StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string format)
702public static string ToString(DateTime value, XmlDateTimeSerializationMode dateTimeOption)
1195public static DateTime ToDateTime(string s)
1200public static DateTime ToDateTime(string s, [StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string format)
1202return DateTime.ParseExact(s, format, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AllowLeadingWhite | DateTimeStyles.AllowTrailingWhite);
1205public static DateTime ToDateTime(string s, [StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string[] formats)
1207return DateTime.ParseExact(s, formats, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AllowLeadingWhite | DateTimeStyles.AllowTrailingWhite);
1210public static DateTime ToDateTime(string s, XmlDateTimeSerializationMode dateTimeOption)
1213DateTime dt = (DateTime)xsdDateTime;
1288private static DateTime SwitchToLocalTime(DateTime value) =>
1297private static DateTime SwitchToUtcTime(DateTime value) =>
1754internal static bool TryFormat(DateTime value, [StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string format, Span<char> destination, out int charsWritten)
1759internal static bool TryFormat(DateTime value, Span<char> destination, out int charsWritten)
1764internal static bool TryFormat(DateTime value, XmlDateTimeSerializationMode dateTimeOption, Span<char> destination, out int charsWritten)
System\Xml\Xsl\IlGen\XmlIlTypeHelper.cs (16)
67typeof(DateTime), // XmlTypeCode.DateTime
68typeof(DateTime), // XmlTypeCode.Time
69typeof(DateTime), // XmlTypeCode.Date
70typeof(DateTime), // XmlTypeCode.GYearMonth
71typeof(DateTime), // XmlTypeCode.GYear
72typeof(DateTime), // XmlTypeCode.GMonthDay
73typeof(DateTime), // XmlTypeCode.GDay
74typeof(DateTime), // XmlTypeCode.GMonth
125typeof(IList<DateTime>), // XmlTypeCode.DateTime
126typeof(IList<DateTime>), // XmlTypeCode.Time
127typeof(IList<DateTime>), // XmlTypeCode.Date
128typeof(IList<DateTime>), // XmlTypeCode.GYearMonth
129typeof(IList<DateTime>), // XmlTypeCode.GYear
130typeof(IList<DateTime>), // XmlTypeCode.GMonthDay
131typeof(IList<DateTime>), // XmlTypeCode.GDay
132typeof(IList<DateTime>), // XmlTypeCode.GMonth
System.Private.Xml.Linq (23)
System.Reflection.Metadata (4)
System.Resources.Extensions (8)
System.Resources.Writer (2)
System.Runtime (1)
System.Runtime.Caching (72)
System\Runtime\Caching\CacheExpires.cs (28)
52internal DateTime _utcExpires;
103private DateTime _utcMinExpires;
105private DateTime _utcLastCountReset;
107internal ExpiresBucket(CacheExpires cacheExpires, byte bucket, DateTime utcNow)
129private void ResetCounts(DateTime utcNow)
132_utcMinExpires = DateTime.MaxValue;
140private int GetCountIndex(DateTime utcExpires)
145private void AddCount(DateTime utcExpires)
159private void RemoveCount(DateTime utcExpires)
168private int GetExpiresCount(DateTime utcExpires)
562ResetCounts(DateTime.UtcNow);
571",now=" + DateTime.Now.ToString("o", CultureInfo.InvariantCulture) +
583internal void UtcUpdateCacheEntry(MemoryCacheEntry cacheEntry, DateTime utcExpires)
605internal int FlushExpiredItems(DateTime utcNow, bool useInsertBlock)
679" expired items, bucket=" + _bucket + "; Time=" + DateTime.Now.ToString("o", CultureInfo.InvariantCulture));
743" expired items, bucket=" + _bucket + "; Time=" + DateTime.Now.ToString("o", CultureInfo.InvariantCulture));
770private DateTime _utcLastFlush;
777DateTime utcNow = DateTime.UtcNow;
787private static int UtcCalcExpiresBucket(DateTime utcDate)
807DateTime utcNow = DateTime.UtcNow;
816Dbg.Trace("CacheExpiresFlushTotal", "FlushExpiredItems flushed a total of " + flushed + " items; Time=" + DateTime.Now.ToString("o", CultureInfo.InvariantCulture));
844DateTime utcNow = DateTime.UtcNow;
897DateTime utcNow = DateTime.UtcNow;
916internal void UtcUpdate(MemoryCacheEntry cacheEntry, DateTime utcNewExpires)
System.Runtime.InteropServices (4)
System.Runtime.InteropServices.JavaScript (4)
System.Runtime.Serialization.Formatters (3)
System.Security.Cryptography (84)
System\Security\Cryptography\X509Certificates\OpenSslCachedSystemStoreProvider.cs (12)
27private static DateTime[]? s_directoryLastWrite;
28private static DateTime s_fileLastWrite;
120_ = TryStatFile(s_rootStoreFile, out DateTime lastModified, out _);
131_ = TryStatDirectory(s_rootStoreDirectories[i], out DateTime lastModified);
161s_directoryLastWrite = new DateTime[s_rootStoreDirectories.Length];
185hasStoreData = ProcessDir(DefaultCertDir, out DateTime lastModified);
193bool ProcessDir(string dir, out DateTime lastModified)
210bool ProcessFile(string file, out DateTime lastModified)
372private static bool TryStatDirectory(string path, out DateTime lastModified)
375private static bool TryStatFile(string path, out DateTime lastModified, out (long, long) fileId)
378private static bool TryStat(string path, int fileType, out DateTime lastModified, out (long, long) fileId)
390lastModified = DateTime.UnixEpoch + TimeSpan.FromTicks(status.MTime * TimeSpan.TicksPerSecond + status.MTimeNsec / TimeSpan.NanosecondsPerTick);
System.Security.Cryptography.Pkcs (15)
System.ServiceModel.Federation (19)
System.ServiceModel.NetFramingBase (10)
System.ServiceModel.NetNamedPipe (7)
System.ServiceModel.NetTcp (10)
System.ServiceModel.Primitives (177)
System\ServiceModel\Security\Tokens\SecurityContextSecurityToken.cs (15)
17private DateTime _tokenEffectiveTime;
18private DateTime _tokenExpirationTime;
30internal SecurityContextSecurityToken(SecurityContextSecurityToken sourceToken, string id, byte[] key, UniqueId keyGeneration, DateTime keyEffectiveTime, DateTime keyExpirationTime, ReadOnlyCollection<IAuthorizationPolicy> authorizationPolicies)
70public DateTime KeyEffectiveTime { get; private set; }
72public DateTime KeyExpirationTime { get; private set; }
96public override DateTime ValidFrom
101public override DateTime ValidTo
116DateTime TimeBoundedCache.IExpirableItem.ExpirationTime
129private void Initialize(UniqueId contextId, byte[] key, DateTime validFrom, DateTime validTo, ReadOnlyCollection<IAuthorizationPolicy> authorizationPolicies, bool isCookieMode,
130UniqueId keyGeneration, DateTime keyEffectiveTime, DateTime keyExpirationTime)
137DateTime tokenEffectiveTimeUtc = validFrom.ToUniversalTime();
138DateTime tokenExpirationTimeUtc = validTo.ToUniversalTime();
System.ServiceModel.Primitives.Tests (8)
System.ServiceModel.UnixDomainSocket (6)
System.Speech (1)
System.Text.Json (97)
System\Text\Json\JsonHelpers.Date.cs (9)
45/// <param name="value">The parsed <see cref="DateTime"/> if successful.</param>
47public static bool TryParseAsISO(ReadOnlySpan<byte> source, out DateTime value)
103TryCreateDateTime(parseData, DateTimeKind.Unspecified, out DateTime dateTime))
406private static bool TryCreateDateTimeOffset(DateTime dateTime, ref DateTimeParseData parseData, out DateTimeOffset value)
452if (!TryCreateDateTime(parseData, kind: DateTimeKind.Unspecified, out DateTime dateTime))
472if (!TryCreateDateTime(parseData, DateTimeKind.Local, out DateTime dateTime))
496private static bool TryCreateDateTime(DateTimeParseData parseData, DateTimeKind kind, out DateTime value)
513if (dayMinusOne >= 28 && dayMinusOne >= DateTime.DaysInMonth(parseData.Year, parseData.Month))
541ReadOnlySpan<int> days = DateTime.IsLeapYear(parseData.Year) ? DaysToMonth366 : DaysToMonth365;
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.DateTime.cs (23)
13/// Writes the pre-encoded property name and <see cref="DateTime"/> value (as a JSON string) as part of a name/value pair of a JSON object.
21/// Writes the <see cref="DateTime"/> using the round-trippable ('O') <see cref="StandardFormat"/> , for example: 2017-06-12T05:30:45.7680000.
24public void WriteString(JsonEncodedText propertyName, DateTime value)
36/// Writes the property name and <see cref="DateTime"/> value (as a JSON string) as part of a name/value pair of a JSON object.
50/// Writes the <see cref="DateTime"/> using the round-trippable ('O') <see cref="StandardFormat"/> , for example: 2017-06-12T05:30:45.7680000.
53public void WriteString(string propertyName, DateTime value)
60/// Writes the property name and <see cref="DateTime"/> value (as a JSON string) as part of a name/value pair of a JSON object.
71/// Writes the <see cref="DateTime"/> using the round-trippable ('O') <see cref="StandardFormat"/> , for example: 2017-06-12T05:30:45.7680000.
74public void WriteString(ReadOnlySpan<char> propertyName, DateTime value)
85/// Writes the property name and <see cref="DateTime"/> value (as a JSON string) as part of a name/value pair of a JSON object.
96/// Writes the <see cref="DateTime"/> using the round-trippable ('O') <see cref="StandardFormat"/> , for example: 2017-06-12T05:30:45.7680000.
99public void WriteString(ReadOnlySpan<byte> utf8PropertyName, DateTime value)
109private void WriteStringEscape(ReadOnlySpan<char> propertyName, DateTime value)
125private void WriteStringEscape(ReadOnlySpan<byte> utf8PropertyName, DateTime value)
141private void WriteStringEscapeProperty(ReadOnlySpan<char> propertyName, DateTime value, int firstEscapeIndexProp)
164private void WriteStringEscapeProperty(ReadOnlySpan<byte> utf8PropertyName, DateTime value, int firstEscapeIndexProp)
187private void WriteStringByOptions(ReadOnlySpan<char> propertyName, DateTime value)
200private void WriteStringByOptions(ReadOnlySpan<byte> utf8PropertyName, DateTime value)
213private void WriteStringMinimized(ReadOnlySpan<char> escapedPropertyName, DateTime value)
247private void WriteStringMinimized(ReadOnlySpan<byte> escapedPropertyName, DateTime value)
281private void WriteStringIndented(ReadOnlySpan<char> escapedPropertyName, DateTime value)
330private void WriteStringIndented(ReadOnlySpan<byte> escapedPropertyName, DateTime value)
379internal void WritePropertyName(DateTime value)
System.Transactions.Local (4)
System.Windows.Forms (172)
System.Windows.Forms.Design (57)
System.Windows.Forms.Design.Tests (10)
System.Windows.Forms.Primitives (2)
System.Windows.Forms.Primitives.Tests (42)
System.Windows.Forms.Primitives.TestUtilities (1)
System.Windows.Forms.Tests (356)
System.Windows.Forms.UI.IntegrationTests (11)
System.Xaml (10)
System.Xaml.Tests (26)
System\Windows\Markup\DateTimeValueSerializerTests.cs (5)
39public void ConvertToString_DateTime_ReturnsExpected(DateTime date, string format)
63yield return new object[] { "", DateTime.MinValue };
65foreach (DateTime date in new DateTime[] { new DateTime(2018, 12, 9), new DateTime(2018, 12, 9, 1, 2, 0, 0), new DateTime(2018, 12, 9, 1, 2, 3, 0) })
73public void ConvertFromString_String_ReturnsExpected(string value, DateTime expected)
System\Xaml\Replacements\DateTimeConverter2Tests.cs (15)
22var type = new XamlType(typeof(DateTime), new XamlSchemaContext());
29yield return new object[] { "", DateTime.MinValue };
31foreach (DateTime date in new DateTime[] { new DateTime(2018, 12, 9), new DateTime(2018, 12, 9, 1, 2, 0, 0), new DateTime(2018, 12, 9, 1, 2, 3, 0) })
39public void ConvertFrom_String_ReturnsExpected(string value, DateTime expected)
41var type = new XamlType(typeof(DateTime), new XamlSchemaContext());
51var type = new XamlType(typeof(DateTime), new XamlSchemaContext());
63var type = new XamlType(typeof(DateTime), new XamlSchemaContext());
80public void ConvertTo_DateTime_ReturnsExpected(DateTime date, string format)
82var type = new XamlType(typeof(DateTime), new XamlSchemaContext());
92var type = new XamlType(typeof(DateTime), new XamlSchemaContext());
102var type = new XamlType(typeof(DateTime), new XamlSchemaContext());
104Assert.Throws<NotSupportedException>(() => converter.ConvertTo(DateTime.MinValue, destinationType));
110var type = new XamlType(typeof(DateTime), new XamlSchemaContext());
112Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(DateTime.MinValue, null!));
TestingAppHost1.MyWebApp (1)
Text.Analyzers (7)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
737is nameof(DateTime)
UIAutomationClient (10)
UnitTests.Common (2)
UnsupportedTypes (1)
Wasm.Performance.ConsoleHost (3)
Wasm.Performance.Driver (8)
Wasm.Performance.TestApp (3)
WebPubSubWeb (1)
WebTransportInteractiveSampleApp (1)
WebTransportSampleApp (1)
WindowsBase.Tests (36)
System\Security\RightsManagement\ContentGrantTests.cs (36)
32Assert.Equal(DateTime.MinValue, grant.ValidFrom);
33Assert.Equal(DateTime.MaxValue, grant.ValidUntil);
37yield return new object[] { ContentUser.AnyoneUser, ContentRight.View, DateTime.MinValue, DateTime.MaxValue };
38yield return new object[] { ContentUser.OwnerUser, ContentRight.Edit, DateTime.MinValue, DateTime.MaxValue };
39yield return new object[] { new ContentUser("name", AuthenticationType.Windows), ContentRight.Print, DateTime.MinValue, DateTime.MaxValue };
40yield return new object[] { new ContentUser("name", AuthenticationType.Windows), ContentRight.Extract, DateTime.MinValue, DateTime.MaxValue };
41yield return new object[] { new ContentUser("name", AuthenticationType.Windows), ContentRight.ObjectModel, DateTime.MinValue, DateTime.MaxValue };
42yield return new object[] { new ContentUser("name", AuthenticationType.Windows), ContentRight.Owner, DateTime.MinValue, DateTime.MaxValue };
43yield return new object[] { new ContentUser("name", AuthenticationType.Windows), ContentRight.ViewRightsData, DateTime.MinValue, DateTime.MaxValue };
44yield return new object[] { new ContentUser("name", AuthenticationType.Windows), ContentRight.Forward, DateTime.MinValue, DateTime.MaxValue };
45yield return new object[] { new ContentUser("name", AuthenticationType.Windows), ContentRight.Reply, DateTime.MinValue, DateTime.MaxValue };
46yield return new object[] { new ContentUser("name", AuthenticationType.Windows), ContentRight.ReplyAll, DateTime.MinValue, DateTime.MaxValue };
47yield return new object[] { new ContentUser("name", AuthenticationType.Windows), ContentRight.Sign, DateTime.MinValue, DateTime.MaxValue };
48yield return new object[] { new ContentUser("name", AuthenticationType.Windows), ContentRight.DocumentEdit, DateTime.MinValue, DateTime.MaxValue };
49yield return new object[] { new ContentUser("name", AuthenticationType.Windows), ContentRight.Export, DateTime.MinValue, DateTime.MaxValue };
50yield return new object[] { new ContentUser("name", AuthenticationType.Windows), ContentRight.Export, DateTime.MinValue, DateTime.MinValue };
51yield return new object[] { new ContentUser("name", AuthenticationType.Windows), ContentRight.Export, DateTime.MaxValue, DateTime.MaxValue };
57public void Ctor_ContentUser_ContentRight_DateTime_DateTime(ContentUser user, ContentRight right, DateTime validFrom, DateTime validUntil)
70Assert.Throws<ArgumentNullException>("user", () => new ContentGrant(null, ContentRight.View, DateTime.MinValue, DateTime.MaxValue));
WinFormsControlsTest (3)
WithDockerfile.AppHost (1)
XmlFileLogger (5)
xunit.assert (8)
xunit.console (1)
Yarp.Backend (1)