1045 instantiations of DateTime
Aspire.Dashboard.Components.Tests (3)
Pages\MetricsTests.cs (1)
27private static readonly DateTime s_testTime = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
Pages\TraceDetailsTests.cs (1)
33private static readonly DateTime s_testTime = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
tests\Shared\Telemetry\TelemetryTestHelpers.cs (1)
278var unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
Aspire.Dashboard.Tests (30)
ConsoleLogsTests\LogEntriesTests.cs (3)
37new DateTime(2020, 1, 1, 0, 0, 0, DateTimeKind.Utc), 38new DateTime(2020, 1, 1, 0, 0, 0, DateTimeKind.Utc))); 41var pauseEntry = LogEntry.CreatePause(new DateTime(2024, 1, 1, 0, 0, 0, DateTimeKind.Utc));
Model\ResourceMenuItemsTests.cs (1)
19private static readonly DateTime s_testTime = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
Model\ResourceViewModelTests.cs (1)
16private static readonly DateTime s_dateTime = new(2000, 12, 30, 23, 59, 59, DateTimeKind.Utc);
Model\SpanWaterfallViewModelTests.cs (9)
25trace.AddSpan(TelemetryTestHelpers.CreateOtlpSpan(app1, trace, scope, spanId: "1", parentSpanId: null, startDate: new DateTime(2001, 1, 1, 1, 1, 2, DateTimeKind.Utc))); 26trace.AddSpan(TelemetryTestHelpers.CreateOtlpSpan(app2, trace, scope, spanId: "1-1", parentSpanId: "1", startDate: new DateTime(2001, 1, 1, 1, 1, 3, DateTimeKind.Utc))); 55trace.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")])); 56trace.AddSpan(TelemetryTestHelpers.CreateOtlpSpan(app2, trace, scope, spanId: "2", parentSpanId: null, startDate: new DateTime(2001, 2, 1, 1, 1, 2, DateTimeKind.Utc), kind: OtlpSpanKind.Client)); 101startDate: new DateTime(2001, 1, 1, 1, 1, 2, DateTimeKind.Utc), 128var parentSpan = TelemetryTestHelpers.CreateOtlpSpan(app1, trace, scope, spanId: "parent", parentSpanId: null, startDate: new DateTime(2001, 1, 1, 1, 1, 2, DateTimeKind.Utc)); 129var childSpan = TelemetryTestHelpers.CreateOtlpSpan(app1, trace, scope, spanId: "child", parentSpanId: "parent", startDate: new DateTime(2001, 1, 1, 1, 1, 3, DateTimeKind.Utc)); 150var parentSpan = TelemetryTestHelpers.CreateOtlpSpan(app1, trace, scope, spanId: "parent", parentSpanId: null, startDate: new DateTime(2001, 1, 1, 1, 1, 2, DateTimeKind.Utc)); 151var 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));
TelemetryRepositoryTests\LogTests.cs (1)
21private static readonly DateTime s_testTime = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
TelemetryRepositoryTests\MetricsTests.cs (1)
20private static readonly DateTime s_testTime = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
TelemetryRepositoryTests\OtlpSpanTests.cs (1)
14private static readonly DateTime s_testTime = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
TelemetryRepositoryTests\TraceTests.cs (1)
23private static readonly DateTime s_testTime = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
tests\Shared\Telemetry\TelemetryTestHelpers.cs (1)
278var unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
Aspire.Hosting.Tests (2)
Dashboard\DashboardLifecycleHookTests.cs (1)
217var timestamp = new DateTime(2001, 12, 29, 23, 59, 59, DateTimeKind.Utc);
ReferenceExpressionTests.cs (1)
53["{0:D}", new DateTime(2024,05,22)],
BinaryFormatTests (2)
FormatTests\FormattedObject\HashTableTests.cs (1)
178{ "Hastings", new DateTime(1066, 10, 14) }
FormatTests\FormattedObject\ListTests.cs (1)
107new List<DateTime>() { new(2000, 1, 1) },
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);
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlCodeExporter.cs (1)
289ticks = (new DateTime(dt.Year, dt.Month, dt.Day)).Ticks;
FrameworkFork\Microsoft.Xml\Xml\XmlConvert.cs (4)
860value = new DateTime(value.Ticks, DateTimeKind.Unspecified); 1414dt = new DateTime(dt.Ticks, DateTimeKind.Unspecified); 1493return new DateTime(value.Ticks, DateTimeKind.Local); 1509return new DateTime(value.Ticks, DateTimeKind.Utc);
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlConverter.cs (1)
972value = new DateTime(year, month, day, hour, minute, second, kind);
FrameworkFork\System.ServiceModel\System\IdentityModel\SecurityUtils.cs (2)
51return new DateTime(DateTime.MaxValue.Ticks - TimeSpan.TicksPerDay, DateTimeKind.Utc); 60return new DateTime(DateTime.MinValue.Ticks + TimeSpan.TicksPerDay, DateTimeKind.Utc);
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\SecurityUtils.cs (2)
258return new DateTime(DateTime.MaxValue.Ticks - TimeSpan.TicksPerDay, DateTimeKind.Utc); 267return new DateTime(DateTime.MinValue.Ticks + TimeSpan.TicksPerDay, DateTimeKind.Utc);
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)
SystemClock.cs (1)
37var utcNowPrecisionSeconds = new DateTime((_timeProvider.GetUtcNow().Ticks / TimeSpan.TicksPerSecond) * TimeSpan.TicksPerSecond, DateTimeKind.Utc);
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 (10)
JwtBearerTests.cs (4)
1083NotBefore = new DateTime(2001, 1, 15), 1084Expires = new DateTime(2000, 2, 20), 1091NotBefore = new DateTime(2045, 1, 15), 1098Expires = new DateTime(2000, 2, 20),
JwtBearerTests_Handler.cs (4)
1156NotBefore = new DateTime(2001, 1, 15), 1157Expires = new DateTime(2000, 2, 20), 1164NotBefore = new DateTime(2045, 1, 15), 1171Expires = new DateTime(2000, 2, 20),
TestSecurityToken.cs (2)
22public override DateTime ValidFrom => new DateTime(2008, 3, 22); 24public override DateTime ValidTo => new DateTime(2017, 3, 22);
Microsoft.AspNetCore.Components.Endpoints.Tests (2)
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)
src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\Internal\DateTimeConstants.cs (1)
12internal static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
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);
ParameterViewTest.cs (1)
207var explicitDefaultValue = new DateTime(2018, 3, 20);
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() });
Routing\RouteTableFactoryTests.cs (1)
375new object[] { "/{value:datetime}", "/1955-01-30", new DateTime(1955, 1, 30) },
SupplyParameterFromPersistentComponentStateValueProviderTests.cs (2)
230{ new DateTime(2023, 1, 1), new DateTime(2023, 12, 31) },
Microsoft.AspNetCore.Components.Web.Tests (1)
Forms\InputBaseTest.cs (1)
266Value = new DateTime(1915, 3, 2),
Microsoft.AspNetCore.Grpc.JsonTranscoding (1)
src\Grpc\JsonTranscoding\src\Shared\Legacy.cs (1)
52private static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
Microsoft.AspNetCore.Grpc.Swagger (1)
src\Grpc\JsonTranscoding\src\Shared\Legacy.cs (1)
52private static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
Microsoft.AspNetCore.Html.Abstractions.Tests (2)
HtmlContentBuilderExtensionsTest.cs (1)
346builder.AppendFormat(CultureInfo.CurrentCulture, "{0:D}", new DateTime(2015, 02, 01));
HtmlFormattableStringTest.cs (1)
196var formattableString = new HtmlFormattableString("{0:D}", new DateTime(2015, 02, 01));
Microsoft.AspNetCore.HttpLogging.Tests (2)
FileLoggerProcessorTests.cs (1)
18private DateTime _today = new DateTime(2021, 01, 01, 12, 00, 00);
W3CLoggerTests.cs (1)
11readonly DateTime _timestampOne = new DateTime(2021, 01, 02, 03, 04, 05);
Microsoft.AspNetCore.Identity (1)
TimeProviderClock.cs (1)
29var utcNowPrecisionSeconds = new DateTime((_timeProvider.GetUtcNow().Ticks / TimeSpan.TicksPerSecond) * TimeSpan.TicksPerSecond, DateTimeKind.Utc);
Microsoft.AspNetCore.Identity.Specification.Tests (1)
UserManagerSpecificationTests.cs (1)
1906var lockoutEndDate = new DateTimeOffset(new DateTime(2014, 01, 01));
Microsoft.AspNetCore.Mvc.Core.Test (16)
Formatters\JsonInputFormatterTestBase.cs (1)
214var expected = new DateTime(2012, 02, 01, 00, 45, 00);
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));
ModelBinding\Binders\DateTimeModelBinderTest.cs (1)
160var expected = new DateTime(2019, 06, 14, 2, 30, 4, 0, DateTimeKind.Utc);
ModelBinding\ModelBindingHelperTest.cs (1)
1225yield return new object[] { "2008-01-01", new DateTime(2008, 01, 01) };
ModelBinding\Validation\DefaultObjectValidatorTests.cs (3)
880new DateTime(2014, 1, 1), 881new DateTime(2014, 2, 1), 882new DateTime(2014, 3, 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);
TryValidateModelIntegrationTest.cs (2)
27DatePurchased = new DateTime(2010, 10, 10), 57DatePurchased = new DateTime(2010, 10, 10),
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)
BsonTempDataSerializerTest.cs (2)
116var value = new DateTime(2007, 1, 1); 231var dateTime = new DateTime(2007, 1, 1);
NewtonsoftJsonInputFormatterTest.cs (1)
517Assert.Equal(new DateTime(2019, 05, 15, 00, 00, 00, DateTimeKind.Unspecified), userModel.DateValue);
src\Mvc\Mvc.Core\test\Formatters\JsonInputFormatterTestBase.cs (1)
214var expected = new DateTime(2012, 02, 01, 00, 45, 00);
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)
InputTagHelperTest.cs (4)
783DateTime = new DateTime(2011, 8, 31, hour: 5, minute: 30, second: 45, kind: DateTimeKind.Utc), 2088var model = new DateTime( 2219var model = new DateTime( 2343var model = new DateTime(
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (11)
CachedExpressionCompilerTest.cs (4)
417var model = new DateTime(2000, 1, 1); 449var model = new DateTime(2000, 1, 1); 482var dateTime = new DateTime(2000, 1, 1); 737var expected = new DateTime(2001, 1, 1);
DefaultEditorTemplatesTest.cs (2)
1042var model = new DateTime( 1111var model = new DateTime(
FormatWeekHelperTest.cs (1)
32var model = new DateTime(year, month, day);
Infrastructure\DefaultTempDataSerializerTest.cs (1)
19var value = new DateTime(2009, 1, 1, 12, 37, 43);
Infrastructure\TempDataSerializerTestBase.cs (2)
137var value = new DateTime(2009, 1, 1, 12, 37, 43); 181var value = new DateTime(2009, 1, 1, 12, 37, 43);
Rendering\HtmlHelperValueTest.cs (1)
254ObjectProperty = new DateTime(1900, 1, 1, 0, 0, 0),
Microsoft.AspNetCore.OpenApi.SourceGenerators.Tests (2)
AdditionalTextsTests.Schemas.cs (1)
239Assert.Equal(new DateTime(2022, 01, 01), dateTimeTypeExample.GetValue<DateTime>());
SchemaTests.cs (1)
231Assert.Equal(new DateTime(2022, 01, 01), dateTimeTypeExample.GetValue<DateTime>());
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (1)
RequestHeaderTests.cs (1)
289yield return (HttpSysRequestHeader.Date, new DateTime(2022, 11, 14).ToString("r", CultureInfo.InvariantCulture));
Microsoft.AspNetCore.SignalR.Common.Tests (3)
Internal\Protocol\CustomObject.cs (1)
17public DateTime DateTimeProp { get; set; } = new DateTime(2017, 4, 11, 0, 0, 0, DateTimeKind.Utc);
Internal\Protocol\MessagePackHubProtocolTests.cs (2)
31var originalDateTime = new DateTime(2018, 4, 9, 0, 0, 0, dateTimeKind); 60var dateTimeOffset = new DateTimeOffset(new DateTime(2018, 4, 9), TimeSpan.FromHours(10));
Microsoft.Build (1)
Logging\BinaryLogger\BuildEventArgsReader.cs (1)
1749return new DateTime(_binaryReader.ReadInt64(), (DateTimeKind)ReadInt32());
Microsoft.Build.Engine.UnitTests (66)
BackEnd\BinaryTranslator_Tests.cs (2)
164HelperTestSimpleType(new DateTime(), DateTime.Now); 165HelperTestSimpleType(DateTime.Now, new DateTime());
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)
60DateTime startAt = new DateTime(2023, 01, 02, 10, 11, 22); 61DateTime innerStartAt = new DateTime(2023, 01, 02, 10, 20, 30); 62DateTime finishedAt = new DateTime(2023, 12, 13, 14, 15, 16);
BackEnd\TargetUpToDateChecker_Tests.cs (45)
639new DateTime(2000, 1, 1), /* input1 */ 640new DateTime(2000, 1, 1), /* input2 */ 641new DateTime(2001, 1, 1), /* output1 */ 642new DateTime(2001, 1, 1), /* output2 */ 653new DateTime(2002, 1, 1), /* input1 */ 654new DateTime(2000, 1, 1), /* input2 */ 655new DateTime(2003, 1, 1), /* output1 */ 656new DateTime(2001, 1, 1), /* output2 */ 667new DateTime(2000, 1, 1), /* input1 */ 668new DateTime(2002, 1, 1), /* input2 */ 669new DateTime(2001, 1, 1), /* output1 */ 670new DateTime(2003, 1, 1), /* output2 */ 681new DateTime(2000, 1, 1), /* input1 */ 682new DateTime(2000, 1, 1), /* input2 */ 683new DateTime(2000, 1, 1), /* output1 */ 684new DateTime(2000, 1, 1), /* output2 */ 696new DateTime(2000, 1, 1), /* input2 */ 697new DateTime(2002, 1, 1), /* output1 */ 698new DateTime(2002, 1, 1), /* output2 */ 710new DateTime(2000, 1, 1), /* input1 */ 712new DateTime(2002, 1, 1), /* output1 */ 713new DateTime(2002, 1, 1), /* output2 */ 724new DateTime(2000, 1, 1), /* input1 */ 725new DateTime(2000, 1, 1), /* input2 */ 726new DateTime(2002, 1, 1), /* output1 */ 738new DateTime(2000, 1, 1), /* input1 */ 739new DateTime(2000, 1, 1), /* input2 */ 741new DateTime(2002, 1, 1), /* output2 */ 753new DateTime(2000, 1, 1), /* input2 */ 755new DateTime(2002, 1, 1), /* output2 */ 766new DateTime(2002, 1, 1), /* input1 */ 768new DateTime(2000, 1, 1), /* output1 */ 769new DateTime(2002, 1, 1), /* output2 */ 784new DateTime(2000, 1, 1), /* input1 */ 786new DateTime(2002, 1, 1), /* output1 */ 787new DateTime(2002, 1, 1), /* output2 */ 802new DateTime(2000, 1, 1), /* input1 */ 803new DateTime(2000, 1, 1), /* input2 */ 804new DateTime(2002, 1, 1), /* output1 */ 820new DateTime(2000, 1, 1), /* input1 */ 821new DateTime(2003, 1, 1), /* input2 */ 822new DateTime(2002, 1, 1), /* output1 */ 957private static readonly DateTime Old = new DateTime(2000, 1, 1); 958private static readonly DateTime Middle = new DateTime(2001, 1, 1); 959private static readonly DateTime New = new DateTime(2002, 1, 1);
BackEnd\TaskBuilder_Tests.cs (1)
246files = ObjectModelHelpers.GetTempFiles(2, new DateTime(2005, 1, 1));
Evaluation\Expander_Tests.cs (1)
40private string _dateToParse = new DateTime(2010, 12, 25).ToString(CultureInfo.CurrentCulture);
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)
43private readonly DateTime _buildStartTime = new DateTime(2023, 3, 30, 16, 30, 0); 44private readonly DateTime _targetStartTime = new DateTime(2023, 3, 30, 16, 30, 1); 45private readonly DateTime _messageTime = new DateTime(2023, 3, 30, 16, 30, 2); 46private readonly DateTime _buildFinishTime = new DateTime(2023, 3, 30, 16, 30, 5);
Microsoft.Build.Framework (4)
BinaryReaderExtensions.cs (1)
64var timestamp = new DateTime(timestampTicks, kind);
BinaryTranslator.cs (1)
400value = new DateTime(_reader.ReadInt64(), kind);
BuildEventArgs.cs (2)
219timestamp = new DateTime(timestampTicks, kind); 223timestamp = new DateTime(timestampTicks);
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)
FileState.cs (2)
84LastWriteTimeUtc = new DateTime(1601, 1, 1); 292return _data.Value.Exists ? _data.Value.LastWriteTimeUtc : new DateTime(1601, 1, 1);
Microsoft.Build.Tasks.UnitTests (2)
FileStateTests.cs (2)
241var time = new DateTime(2111, 1, 1); 267var time = new DateTime(2111, 1, 1);
Microsoft.CodeAnalysis (3)
MetadataReader\PEModule.cs (1)
1610defaultValue = ConstantValue.Create(new DateTime(value));
Symbols\Attributes\CommonAttributeData.cs (1)
250return ConstantValue.Create(new DateTime(value));
VersionHelper.cs (1)
192TimeSpan days = time.Date - new DateTime(2000, 1, 1);
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (4)
Emit\EditAndContinue\AssemblyReferencesTests.cs (4)
585var compilation0 = CreateCompilation(source0.Tree, options: options.WithCurrentLocalTime(new DateTime(2016, 1, 1, 1, 0, 0))); 586var compilation1 = compilation0.WithSource(source1.Tree).WithOptions(options.WithCurrentLocalTime(new DateTime(2016, 1, 1, 1, 0, 10))); 587var compilation2 = compilation1.WithSource(source2.Tree).WithOptions(options.WithCurrentLocalTime(new DateTime(2016, 1, 1, 1, 0, 20))); 588var compilation3 = compilation2.WithSource(source3.Tree).WithOptions(options.WithCurrentLocalTime(new DateTime(2016, 1, 1, 1, 0, 30)));
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (1)
Attributes\AttributeTests_Assembly.cs (1)
84var comp = CreateCompilation(s, options: TestOptions.ReleaseDll.WithCurrentLocalTime(new DateTime(2300, 1, 1)));
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (7)
Semantics\LambdaTests.cs (1)
4931Assert.Equal(new DateTime(638004778421967416L), parameter.DefaultValueFromAttributes.Value);
Semantics\NamedAndOptionalTests.cs (6)
2372Assert.Equal(isFromSource ? ConstantValue.Create(new DateTime(0)) : null, parameters[3].ExplicitDefaultConstantValue); // not imported for non-optional parameter 2379Assert.Equal(isFromSource ? ConstantValue.Create(new DateTime(1)) : null, parameters[4].ExplicitDefaultConstantValue); // not imported for non-optional parameter 2384Assert.Equal(new DateTime(0), parameters[5].ExplicitDefaultValue); 2385Assert.Equal(ConstantValue.Create(new DateTime(0)), parameters[5].ExplicitDefaultConstantValue); 2390Assert.Equal(new DateTime(1), parameters[6].ExplicitDefaultValue); 2391Assert.Equal(ConstantValue.Create(new DateTime(1)), parameters[6].ExplicitDefaultConstantValue);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (3)
Compilation\CSharpCompilationOptionsTests.cs (1)
130TestProperty((old, value) => old.WithCurrentLocalTime(value), opt => opt.CurrentLocalTime, new DateTime(2005, 1, 1));
Symbols\Metadata\PE\LoadingAttributes.cs (2)
1448Assert.Equal(parameters.Last().ExplicitDefaultValue, new DateTime(2013, 1, 1)); 1474Assert.Equal(parameters.Last().ExplicitDefaultValue, new DateTime(2013, 1, 1));
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (1)
src\Test\PdbUtilities\Shared\DateTimeUtilities.cs (1)
21return new DateTime(tickCount);
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider (2)
src\ExpressionEvaluator\Core\Source\ResultProvider\Formatter.Values.cs (1)
459obj = new DateTime((long)dateDataValue.HostObjectValue);
src\Test\PdbUtilities\Shared\DateTimeUtilities.cs (1)
21return new DateTime(tickCount);
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.Utilities (2)
src\ExpressionEvaluator\Core\Source\ResultProvider\Formatter.Values.cs (1)
459obj = new DateTime((long)dateDataValue.HostObjectValue);
src\Test\PdbUtilities\Shared\DateTimeUtilities.cs (1)
21return new DateTime(tickCount);
Microsoft.CodeAnalysis.Test.Utilities (1)
Compilation\VersionTestHelpers.cs (1)
15days = (int)(time - new DateTime(2000, 1, 1)).TotalDays; // number of days since Jan 1, 2000
Microsoft.CodeAnalysis.Workspaces (1)
Workspace\Solution\StateChecksums.cs (1)
88var frozenSourceGeneratedDocumentGenerationDateTimes = reader.ReadArray(r => new DateTime(r.ReadInt64()));
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());
DataFrameTests.Utils.cs (1)
145internal static DateTime SampleDateTime = new DateTime(2021, 06, 04);
Microsoft.DotNet.Build.Tasks.Installers (3)
src\CreateDebPackage.cs (1)
19private static readonly DateTime UnixEpoch = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
src\CreateRpmPackage.cs (1)
22private static readonly DateTime UnixEpoch = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
src\GenerateCurrentVersion.cs (1)
126compareDate = new DateTime(1996, 4, 1, 0, 0, 0, DateTimeKind.Utc);
Microsoft.DotNet.Build.Tasks.Packaging.Tests (1)
PackageIndexTests.cs (1)
61File.SetLastWriteTimeUtc(packageIndexFile, new DateTime(originalModifiedTime.Ticks + 100));
Microsoft.DotNet.SourceBuild.Tasks (1)
src\UsageReport\WriteUsageReports.cs (1)
200return new DateTime(long.Parse(creationTime));
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)
test\Shared\JsonSchemaExporter\TestTypes.cs (2)
83Value: new(2021, 1, 1), 88Value: new(new DateTime(2021, 1, 1), TimeSpan.Zero),
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)
Redaction\RedactorTest.cs (1)
280var data = new DateTime(1, 2, 3);
Microsoft.Extensions.Diagnostics.Testing.Tests (1)
Logging\FakeLoggerTests.cs (1)
124var dt = new DateTime(2022, 5, 22);
Microsoft.Extensions.Options.Contextual.Tests (1)
AcceptanceTests.cs (1)
60Date = new DateTime(2000, 1, 1).AddDays(index),
Microsoft.Extensions.TimeProvider.Testing.Tests (1)
FakeTimeProviderTests.cs (1)
280var dto = new DateTimeOffset(new DateTime(2022, 1, 2, 3, 4, 5, 6), TimeSpan.Zero);
Microsoft.Gen.Logging.Generated.Tests (3)
LogMethodTests.cs (1)
828var dt = new DateTime(2022, 5, 22);
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)
UnitTests\DataTypes.cs (1)
240DateTime dt = new DateTime(2017, 03, 05);
Microsoft.ML.Data (2)
DataLoadSave\Binary\Codecs.cs (2)
632_value = new DateTime(ticks == long.MinValue ? default : ticks); 746value = new DateTimeOffset(new DateTime(ticks == long.MinValue ? default : ticks), new TimeSpan(0, offset == short.MinValue ? default : offset, 0));
Microsoft.ML.Samples (7)
Dynamic\DataOperations\DataViewEnumerable.cs (1)
90var date = new DateTime(2012, 1, 1);
Dynamic\DataOperations\FilterRowsByColumn.cs (1)
90var date = new DateTime(2012, 1, 1);
Dynamic\DataOperations\ShuffleRows.cs (1)
78var date = new DateTime(2012, 1, 1);
Dynamic\DataOperations\SkipRows.cs (1)
82var date = new DateTime(2012, 1, 1);
Dynamic\DataOperations\TakeRows.cs (1)
83var date = new DateTime(2012, 1, 1);
Dynamic\Transforms\TimeSeries\LocalizeRootCause.cs (1)
111return new DateTime(2020, 3, 23, 0, 0, 0);
Dynamic\Transforms\TimeSeries\LocalizeRootCauseMultidimension.cs (1)
137return new DateTime(2020, 3, 23, 0, 0, 0);
Microsoft.ML.Tests (9)
DatabaseLoaderTests.cs (1)
267datetimes[1].Should().Be(new DateTime(2018, 1, 1, 0, 0, 0));
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)
TimeSeriesDirectApi.cs (1)
1174return new DateTime(2020, 3, 23, 0, 0, 0);
Microsoft.Net.Http.Headers.Tests (2)
ContentDispositionHeaderValueTest.cs (1)
403contentDisposition.CreationDate = new DateTimeOffset(new DateTime(2011, 2, 15), new TimeSpan(-8, 0, 0));
HeaderUtilitiesTest.cs (1)
30var date = new DateTimeOffset(new DateTime(2018, 1, 1, 1, 1, 1));
Microsoft.VisualBasic.Core (5)
Microsoft\VisualBasic\DateAndTime.vb (5)
41Return New DateTime(Ticks - Ticks Mod TimeSpan.TicksPerSecond) 53Return (New DateTime(DateTime.Now.TimeOfDay.Ticks)).ToString("HH:mm:ss", GetInvariantCultureInfo()) 401Return New DateTime(Year, Month, Day) 449Return (New DateTime(TotalSeconds * TimeSpan.TicksPerSecond)) 460Return New DateTime(CDate([StringTime]).Ticks Mod TimeSpan.TicksPerDay)
MSBuildTaskHost (2)
BinaryReaderExtensions.cs (1)
64var timestamp = new DateTime(timestampTicks, kind);
BinaryTranslator.cs (1)
400value = new DateTime(_reader.ReadInt64(), kind);
PresentationBuildTasks (3)
MS\Internal\MarkupCompiler\VersionHelper.cs (1)
203TimeSpan days = time.Date - new DateTime(2000, 1, 1);
MS\Internal\Tasks\IncrementalCompileAnalyzer.cs (2)
315DateTime nonSet = new DateTime(0); 610private DateTime _lastCompileTime = new DateTime(0);
PresentationCore (2)
System\Windows\LayoutManager.cs (2)
264DateTime loopStartTime = new DateTime(0); 332loopStartTime = new DateTime(0);
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);
System\Windows\Controls\DateTimeHelper.cs (1)
84return new DateTime(d.Year, d.Month, 1, 0, 0, 0);
System\Windows\Controls\Primitives\CalendarItem.cs (2)
1240DateTime day = new DateTime(year, 1, 1); 1284DateTime day = new DateTime(DisplayDate.Year, count + 1, 1);
System\Windows\Markup\Baml2006\WpfGeneratedKnownTypes.cs (1)
3389DefaultConstructor = delegate () { return new System.DateTime(); },
Roslyn.Test.PdbUtilities (1)
Shared\DateTimeUtilities.cs (1)
21return new DateTime(tickCount);
ScenarioTests.Common.Tests (2)
ScenarioTestHelpers.cs (2)
116DateTimeValue = new DateTime(2000, 1, 1), 158DateTimeValue = new DateTime(2000, 1, 1),
Shared.Tests (2)
JsonSchemaExporter\TestTypes.cs (2)
83Value: new(2021, 1, 1), 88Value: new(new DateTime(2021, 1, 1), TimeSpan.Zero),
SignalR.Client.FunctionalTestApp (1)
TestHub.cs (1)
125DateTime = new DateTime(2000, 1, 1, 0, 0, 0, DateTimeKind.Utc),
Stress.TelemetryService (1)
TelemetryStresser.cs (1)
133var unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
System.Data.Common (3)
System\Data\SQLTypes\SQLDateTime.cs (3)
39private static readonly DateTime s_SQLBaseDate = new DateTime(1900, 1, 1); 55private static readonly TimeSpan s_minTimeSpan = new DateTime(1753, 1, 1).Subtract(s_SQLBaseDate); 218DateTime result = new DateTime(s_SQLBaseDateTicks + dayticks + timeticks);
System.Data.Odbc (2)
Common\System\Data\ProviderBase\DbBuffer.cs (2)
679return new DateTime( 718DateTime value = new DateTime(
System.Diagnostics.Process (1)
System\Diagnostics\Process.Linux.cs (1)
97return new DateTime(bootTimeTicks);
System.Formats.Asn1 (1)
System\Formats\Asn1\AsnDecoder.GeneralizedTime.cs (1)
385value = new DateTimeOffset(new DateTime(year, month, day, hour, minute.Value, second.Value));
System.Formats.Nrbf (1)
System\Formats\Nrbf\Utils\BinaryReaderExtensions.cs (1)
164return ((uint)kind <= (uint)DateTimeKind.Local) ? new DateTime((long)ticks, kind) : CreateFromAmbiguousDst(ticks);
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); 75return new DateTime(year, month, day, hour, minute, second, 0);
System.IO.Compression.ZipFile (1)
System\IO\Compression\ZipFileExtensions.ZipArchive.Create.cs (1)
119lastWrite = new DateTime(1980, 1, 1, 0, 0, 0);
System.Net.Requests (1)
System\Net\FtpControlStream.cs (1)
945dateTime = new DateTime(year, month, day, hour, minute, second, millisecond);
System.Private.CoreLib (143)
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.Date.Helpers.cs (1)
155value = new DateTime(ticks: ticks, kind: kind);
src\libraries\System.Private.CoreLib\src\System\Convert.cs (2)
1785return new DateTime(0); 1792return new DateTime(0);
src\libraries\System.Private.CoreLib\src\System\CurrentSystemTimeZone.cs (3)
105return new DateTime(DateTime.MaxTicks, DateTimeKind.Local); 109return new DateTime(DateTime.MinTicks, DateTimeKind.Local); 111return new DateTime(tick, DateTimeKind.Local, isAmbiguousLocalDst);
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 (33)
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); 1518return new DateTime((ulong)tick | KindLocal); 1520return new DateTime((ulong)tick | KindLocalAmbiguousDst); 1522return new DateTime(tick < 0 ? KindLocal : MaxTicks | KindLocal); 1659return new DateTime(ticks | InternalKind); 1726return new DateTime((ulong)tick | KindLocal); 1728return new DateTime((ulong)tick | KindLocalAmbiguousDst); 1730return new DateTime(tick < 0 ? KindLocal : MaxTicks | KindLocal); 1859return new DateTime(ticks | d.InternalKind); 1866return new DateTime(ticks | d.InternalKind); 2014if (!IsValidTimeWithLeapSeconds(new DateTime(ticks))) 2023result = new DateTime(ticks);
src\libraries\System.Private.CoreLib\src\System\DateTime.Unix.cs (1)
14return new DateTime(((ulong)(Interop.Sys.GetSystemTimeAsTicks() + UnixEpochTicks)) | KindUtc);
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\Diagnostics\Tracing\EventPipeEventDispatcher.cs (1)
189return new DateTime(inTicks, DateTimeKind.Utc);
src\libraries\System.Private.CoreLib\src\System\Globalization\Calendar.cs (1)
136return new DateTime(ticks);
src\libraries\System.Private.CoreLib\src\System\Globalization\CalendricalCalculationsHelper.cs (5)
20private static readonly long s_startOf1810 = GetNumberOfDays(new DateTime(1810, 1, 1)); 21private static readonly long s_startOf1900Century = GetNumberOfDays(new DateTime(1900, 1, 1)); 66return new DateTime(Math.Min((long)(Math.Floor(numberOfDays) * TimeSpan.TicksPerDay), DateTime.MaxValue.Ticks)).Year; 139long july1stOfYear = GetNumberOfDays(new DateTime(gregorianYear, 7, 1)); 147long january1stOfYear = GetNumberOfDays(new DateTime(gregorianYear, 1, 1));
src\libraries\System.Private.CoreLib\src\System\Globalization\ChineseLunisolarCalendar.cs (3)
21private static readonly DateTime s_minDate = new DateTime(1901, 2, 19); 22private static readonly DateTime s_maxDate = new DateTime((new DateTime(2101, 1, 28, 23, 59, 59, 999)).Ticks + 9999);
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeParse.cs (5)
2865result.parsedDate = new DateTime(utcTicks, DateTimeKind.Utc); 2892result.parsedDate = new DateTime(resultTicks, DateTimeKind.Utc); 2938DateTime utcDt = new DateTime(resultTicks, DateTimeKind.Utc); 2948result.parsedDate = new DateTime(resultTicks, DateTimeKind.Local, isAmbiguousLocalDst); 3842return new DateTime(DateTime.UtcNow.Ticks + result.timeZoneOffset.Ticks, DateTimeKind.Unspecified);
src\libraries\System.Private.CoreLib\src\System\Globalization\EastAsianLunisolarCalendar.cs (2)
261return new DateTime(gy, gm, gd, hour, minute, second, millisecond); 656_twoDigitYearMax = GetSystemTwoDigitYearSetting(BaseCalendarID, GetYear(new DateTime(DefaultGregorianTwoDigitYearMax, 1, 1)));
src\libraries\System.Private.CoreLib\src\System\Globalization\GregorianCalendar.cs (2)
170return new DateTime(ticks); 395return new DateTime(year, month, day, hour, minute, second, millisecond);
src\libraries\System.Private.CoreLib\src\System\Globalization\GregorianCalendarHelper.cs (4)
28this.ticks = new DateTime(startYear, startMonth, startDay).Ticks; 39this.ticks = new DateTime(startYear, startMonth, startDay).Ticks; 240return new DateTime(ticks); 472return new DateTime(ticks);
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\HijriCalendar.cs (3)
61private static readonly DateTime s_calendarMinValue = new DateTime(622, 7, 18); 301return new DateTime(ticks); 416return new DateTime(lDate * TimeSpan.TicksPerDay + TimeToTicks(hour, minute, second, millisecond));
src\libraries\System.Private.CoreLib\src\System\Globalization\ISOWeek.cs (1)
152var jan4 = new DateTime(year, month: 1, day: 4);
src\libraries\System.Private.CoreLib\src\System\Globalization\JapaneseCalendar.cs (1)
35private static readonly DateTime s_calendarMinValue = new DateTime(1868, 9, 8);
src\libraries\System.Private.CoreLib\src\System\Globalization\JapaneseCalendar.Icu.cs (1)
159dateTime = new DateTime(startYear, startMonth, startDay);
src\libraries\System.Private.CoreLib\src\System\Globalization\JapaneseLunisolarCalendar.cs (3)
22private static readonly DateTime s_minDate = new DateTime(1960, 1, 28); 23private static readonly DateTime s_maxDate = new DateTime((new DateTime(2050, 1, 22, 23, 59, 59, 999)).Ticks + 9999);
src\libraries\System.Private.CoreLib\src\System\Globalization\JulianCalendar.cs (2)
214return new DateTime(ticks); 319return new DateTime(DateToTicks(year, month, day) + (new TimeSpan(0, hour, minute, second, millisecond)).Ticks);
src\libraries\System.Private.CoreLib\src\System\Globalization\KoreanLunisolarCalendar.cs (3)
20private static readonly DateTime s_minDate = new DateTime(918, 2, 19); 21private static readonly DateTime s_maxDate = new DateTime((new DateTime(2051, 2, 10, 23, 59, 59, 999)).Ticks + 9999);
src\libraries\System.Private.CoreLib\src\System\Globalization\PersianCalendar.cs (4)
24private static readonly long s_persianEpoch = new DateTime(622, 3, 22).Ticks / TimeSpan.TicksPerDay; 41private static readonly DateTime s_minDate = new DateTime(622, 3, 22); 250return new DateTime(ticks); 387return new DateTime(lDate * TimeSpan.TicksPerDay + TimeToTicks(hour, minute, second, millisecond));
src\libraries\System.Private.CoreLib\src\System\Globalization\TaiwanCalendar.cs (1)
36private static readonly DateTime s_calendarMinValue = new DateTime(1912, 1, 1);
src\libraries\System.Private.CoreLib\src\System\Globalization\TaiwanLunisolarCalendar.cs (3)
30private static readonly DateTime s_minDate = new DateTime(1912, 2, 18); 31private static readonly DateTime s_maxDate = new DateTime((new DateTime(2051, 2, 10, 23, 59, 59, 999)).Ticks + 9999);
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\Resources\ResourceReader.cs (1)
596return new DateTime(_store.ReadInt64());
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\DateTimeConstantAttribute.cs (1)
13_date = new DateTime(ticks);
src\libraries\System.Private.CoreLib\src\System\TimeZone.cs (4)
94return new DateTime(DateTime.MaxTicks, DateTimeKind.Utc); 98return new DateTime(DateTime.MinTicks, DateTimeKind.Utc); 100return new DateTime(tickCount, DateTimeKind.Utc); 114return new DateTime(time.Ticks + offset, DateTimeKind.Local, isAmbiguousLocalDst);
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.cs (19)
143private static readonly DateTime s_maxDateOnly = new DateTime(9999, 12, 31); 144private static readonly DateTime s_minDateOnly = new DateTime(1, 1, 2); 810return new DateTime(targetConverted.Ticks, DateTimeKind.Local, isAmbiguousLocalDst); 814return new DateTime(targetConverted.Ticks, targetKind); 1303new DateTime(ticks); 1317new DateTime(ticks); 1326new DateTime(ticks); 1376new DateTime(daylightTime.Start.Year, 1, 1) : 1380new DateTime(daylightTime.End.Year + 1, 1, 1).AddTicks(-1) : 1405new DateTime(daylightTime.Start.Year, 1, 1) : 1409new DateTime(daylightTime.End.Year + 1, 1, 1).AddTicks(-1) : 1495startTime = new DateTime(startYear, 1, 1) - dstStartOffset; 1513endTime = new DateTime(endYear + 1, 1, 1).AddTicks(-1) - dstEndOffset; 1577AdjustmentRule? nextYearRule = zone.GetAdjustmentRuleForTime(new DateTime(nextYear, 1, 1), out int? nextYearRuleIndex); 1594dstEnd = new DateTime(nextYear, 12, 31) - utc - nextYearRule.BaseUtcOffsetDelta - nextYearRule.DaylightDelta; 1627AdjustmentRule? previousYearRule = zone.GetAdjustmentRuleForTime(new DateTime(previousYear, 12, 31), out int? previousYearRuleIndex); 1942value = new DateTime(year, transitionTime.Month, day) + timeOfDay; 1951value = new DateTime(year, transitionTime.Month, 1) + timeOfDay; 1972value = new DateTime(year, transitionTime.Month, daysInMonth) + timeOfDay;
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 822timeOfDay = new DateTime(1, 1, 2, 0, 0, 0); 826timeOfDay = new DateTime(1, 1, 1, 0, 0, 0); 834timeOfDay = new DateTime(1, 1, 1, 2, 0, 0);
src\System\Reflection\MdConstant.cs (1)
104return new DateTime(defaultValue);
src\System\Reflection\RuntimeParameterInfo.cs (1)
400return new DateTime((long)attr.ConstructorArguments[0].Value!);
System.Private.DataContractSerialization (3)
System\Runtime\Serialization\Json\JsonGlobals.cs (1)
20public static readonly long unixEpochTicks = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).Ticks;
System\Runtime\Serialization\Json\JsonReaderDelegator.cs (1)
186DateTime dateTime = new DateTime(ticks, DateTimeKind.Utc);
System\Xml\XmlConverter.cs (1)
932value = new DateTime(year, month, day, hour, minute, second, kind);
System.Private.Windows.Core (2)
System\IO\BinaryReaderExtensions.cs (1)
37_ = new DateTime(data & TicksMask);
System\Value.UtcDateTimeOffsetFlag.cs (1)
12public override DateTimeOffset To(in Value value) => new(new DateTime(value._union.Ticks, DateTimeKind.Utc));
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\Xml\XmlConvert.cs (5)
715value = new DateTime(value.Ticks, DateTimeKind.Unspecified); 1226dt = new DateTime(dt.Ticks, DateTimeKind.Unspecified); 1292DateTimeKind.Unspecified => new DateTime(value.Ticks, DateTimeKind.Local), 1301DateTimeKind.Unspecified => new DateTime(value.Ticks, DateTimeKind.Utc), 1777value = new DateTime(value.Ticks, DateTimeKind.Unspecified);
System.Reflection.Metadata (2)
System\Reflection\Metadata\BlobContentId.cs (1)
122uint timestamp = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
System\Reflection\Metadata\BlobReader.cs (1)
365return new DateTime(ReadInt64());
System.Resources.Extensions (1)
src\libraries\System.Private.CoreLib\src\System\Resources\ResourceReader.cs (1)
596return new DateTime(_store.ReadInt64());
System.Runtime.Caching (1)
System\Runtime\Caching\MemoryCacheEntryChangeMonitor.cs (1)
18private static readonly DateTime s_DATETIME_MINVALUE_UTC = new DateTime(0, DateTimeKind.Utc);
System.Security.Cryptography (1)
System\Security\Cryptography\X509Certificates\CertificateRequest.cs (1)
816notAfterLocal = new DateTime(notAfterLocalTicks, notAfterLocal.Kind);
System.Text.Json (1)
System\Text\Json\JsonHelpers.Date.cs (1)
548value = new DateTime(ticks: ticks, kind: kind);
System.Transactions.Local (1)
System\Transactions\TransactionInformation.cs (1)
74public DateTime CreationTime => new DateTime(_internalTransaction.CreationTime);
System.Windows.Forms (3)
System\Windows\Forms\Controls\DateTimePicker\DateTimePicker.cs (3)
64public static readonly DateTime MinDateTime = new(1753, 1, 1); 71public static readonly DateTime MaxDateTime = new(9998, 12, 31); 692return new DateTime(1753, 1, 1);
System.Windows.Forms.Primitives.Tests (24)
Interop\Kernel32\FILETIMETests.cs (2)
29DateTime dt = new DateTime(2020, 05, 13, 13, 3, 12, DateTimeKind.Utc).ToLocalTime(); 43Assert.Equal(new DateTime(2020, 05, 13, 13, 3, 12, DateTimeKind.Utc).ToLocalTime(), ft.ToDateTime());
Interop\Oleaut32\VARIANTTests.cs (22)
720DateTime dt = new(2020, 05, 13, 13, 3, 12); 726AssertToObjectEqualExtension<ArgumentException>(new DateTime(2020, 05, 13, 13, 3, 12), variant); 752DateTime dt = new DateTime(2020, 05, 13, 13, 3, 12, DateTimeKind.Utc).ToLocalTime(); 758AssertToObjectEqual(new DateTime(2020, 05, 13, 13, 3, 12, DateTimeKind.Utc).ToUniversalTime(), variant); 764DateTime dt = new(2020, 05, 13, 13, 3, 12); 778AssertToObjectEqual(new DateTime(2020, 05, 13, 13, 3, 12), variant); 785AssertToObjectEqual(new DateTime(1899, 12, 30), variant); 791DateTime dt = new(2020, 05, 13, 13, 3, 12); 805AssertToObjectEqual(new DateTime(2020, 05, 13, 13, 3, 12), variant); 815AssertToObjectEqual(new DateTime(1899, 12, 30), variant); 1676DateTime d1 = new(2020, 05, 13, 13, 3, 12); 1677DateTime d2 = new(2020, 05, 13, 13, 3, 11); 1678DateTime d3 = new(2020, 3, 13, 13, 3, 12); 1717DateTime d1 = new(2020, 05, 13, 13, 3, 12); 1718DateTime d2 = new(2020, 05, 13, 13, 3, 11); 1719DateTime d3 = new(2020, 3, 13, 13, 3, 12); 4300DateTime d1 = new(2020, 05, 13, 13, 3, 12); 4301DateTime d2 = new(2020, 05, 13, 13, 3, 11); 4302DateTime d3 = new(2020, 3, 13, 13, 3, 12); 4303DateTime d4 = new(1892, 1, 2, 3, 4, 5, 6); 4304DateTime d5 = new(2010, 2, 3, 4, 5, 6); 4305DateTime d6 = new(8000, 10, 11, 12, 13, 14);
System.Windows.Forms.Tests (409)
System\Resources\ResxDataNodeTests.cs (1)
113{ "Hastings", new DateTime(1066, 10, 14) }
System\Resources\ResXResourceWriterTests.cs (1)
17private readonly DateTime _testDateTime = new(2023, 5, 4);
System\Windows\Forms\AccessibleObjects\DateTimePicker.DateTimePickerAccessibleObjectTests.cs (1)
108DateTime dt = new(2000, 1, 1);
System\Windows\Forms\AccessibleObjects\MonthCalendar.CalendarAccessibleObjectTests.cs (13)
126yield return new object[] { 0, new SelectionRange(new DateTime(2020, 12, 27), new DateTime(2021, 1, 31)) }; 127yield return new object[] { 1, new SelectionRange(new DateTime(2021, 2, 1), new DateTime(2021, 2, 28)) }; 128yield return new object[] { 2, new SelectionRange(new DateTime(2021, 3, 1), new DateTime(2021, 3, 31)) }; 129yield return new object[] { 3, new SelectionRange(new DateTime(2021, 4, 1), new DateTime(2021, 4, 30)) }; 130yield return new object[] { 4, new SelectionRange(new DateTime(2021, 5, 1), new DateTime(2021, 5, 31)) }; 131yield return new object[] { 5, new SelectionRange(new DateTime(2021, 6, 1), new DateTime(2021, 7, 10)) }; 141control.SelectionStart = new DateTime(2021, 1, 1);
System\Windows\Forms\AccessibleObjects\MonthCalendar.CalendarBodyAccessibleObjectTests.cs (1)
139control.SelectionStart = new DateTime(2021, 1, 1);
System\Windows\Forms\AccessibleObjects\MonthCalendar.CalendarCellAccessibleObjectTests.cs (3)
152control.SelectionStart = new DateTime(2021, 6, 16); // Set a date to have a stable test case 182SelectionStart = new DateTime(2022, 10, 1) // Set a date to have a stable test case 225SelectionStart = new DateTime(2022, 10, 1) // Set a date to have a stable test case
System\Windows\Forms\AccessibleObjects\MonthCalendar.CalendarDayOfWeekCellAccessibleObjectTests.cs (2)
130SelectionStart = new DateTime(2022, 10, 1) // Set a date to have a stable test case 174SelectionStart = new DateTime(2022, 10, 1) // Set a date to have a stable test case
System\Windows\Forms\AccessibleObjects\MonthCalendar.CalendarHeaderAccessibleObjectTests.cs (2)
38control.SetSelectionRange(new DateTime(2020, 8, 19), new DateTime(2020, 8, 19));
System\Windows\Forms\AccessibleObjects\MonthCalendar.CalendarWeekNumberCellAccessibleObjectTests.cs (1)
165SelectionStart = new DateTime(2022, 10, 1) // Set a date to have a stable test case
System\Windows\Forms\AccessibleObjects\MonthCalendar.MonthCalendarAccessibleObjectTests.cs (4)
83DateTime dt = new(2000, 1, 1); 126yield return new object[] { new DateTime(2000, 1, 1) }; 265DateTime expectedTodayDate = new(2023, 1, 1); 312DateTime focusedDate = new(2023, 10, 1);
System\Windows\Forms\DateRangeEventArgsTests.cs (2)
14yield return new object[] { new DateTime(10), new DateTime(0) };
System\Windows\Forms\DateTimePickerTests.cs (15)
93Assert.Equal(new DateTime(9998, 12, 31), control.MaxDate); 95Assert.Equal(new DateTime(1753, 1, 1), control.MinDate); 337_dateTimePicker.Value = new(2021, 12, 31); 372DateTime expectedDate = new(2022, 12, 31); 436DateTime expectedDate = minSupportedDateTime.Year < 1753 ? new(1753, 1, 1) : minSupportedDateTime; 438DateTimePicker.MinimumDateTime.Should().BeOnOrAfter(new DateTime(1753, 1, 1, 0, 0, 0)); 488DateTime initialDate = new(2022, 1, 1); 489DateTime newDate = new(2023, 1, 1); 918DateTime dt = new(2000, 1, 2, 3, 4, 5); 930DateTime dt = new(2000, 1, 2, 3, 4, 5); 943DateTime dt = new(2000, 1, 2, 3, 4, 5); 956DateTime dt = new(2000, 1, 2, 3, 4, 5); 970DateTime dt = new(2000, 1, 2, 3, 4, 5); 984DateTime dt = new(2000, 1, 2, 3, 4, 5); 998DateTime dt = new(2000, 1, 2, 3, 4, 5);
System\Windows\Forms\MonthCalendar.SelectionRangeConverterTests.cs (10)
15private readonly SelectionRange _range = new(new DateTime(2022, 1, 1), new DateTime(2022, 12, 31)); 68DateTime value = new(2022, 1, 1); 87{ "2022-01-01", typeof(DateTime), new DateTime(2022, 1, 1) } 110result.Start.Should().Be(new DateTime(2022, 1, 1)); 111result.End.Should().Be(new DateTime(2022, 12, 31)); 124{ "invalid", new DateTime(2022, 12, 31) }, 125{ null, new DateTime(2022, 12, 31) }, 126{ new DateTime(2022, 1, 1), new DateTime(2022, 12, 31) }
System\Windows\Forms\MonthCalendarTests.cs (353)
97Assert.Equal(new DateTime(9998, 12, 31), control.MaxDate); 100Assert.Equal(new DateTime(1753, 1, 1), control.MinDate); 172yield return new object[] { new DateTime[] { new(2019, 01, 1), new(2019, 01, 20) }, new DateTime[] { new(2019, 01, 1), new(2019, 01, 20) } }; 173yield return new object[] { new DateTime[] { new(2017, 01, 1), new(2018, 01, 20) }, new DateTime[] { new(2017, 01, 1), new(2018, 01, 20) } }; 174yield return new object[] { new DateTime[] { new(2019, 01, 1), new(2019, 01, 1), new(2018, 01, 1) }, new DateTime[] { new(2019, 01, 1), new(2019, 01, 1), new(2018, 01, 1) } }; 179new(2019, 01, 1), 180new(2019, 02, 2), 181new(2019, 03, 3), 182new(2019, 04, 4), 183new(2019, 05, 5), 184new(2019, 06, 6), 185new(2019, 07, 7), 186new(2019, 08, 8), 187new(2019, 09, 9), 188new(2019, 10, 10), 189new(2019, 11, 11), 190new(2019, 12, 12), 500yield return new object[] { new DateTime[] { new(2019, 01, 1), new(2019, 01, 20) }, new DateTime[] { new(2019, 01, 1), new(2019, 01, 20) } }; 501yield return new object[] { new DateTime[] { new(2017, 01, 1), new(2018, 01, 20) }, new DateTime[] { new(2017, 01, 1), new(2018, 01, 20) } }; 502yield return new object[] { new DateTime[] { new(2019, 01, 1), new(2019, 01, 1), new(2018, 01, 1) }, new DateTime[] { new(2019, 01, 1), new(2019, 01, 1), new(2018, 01, 1) } }; 507new(2019, 01, 1), 508new(2019, 02, 2), 509new(2019, 03, 3), 510new(2019, 04, 4), 511new(2019, 05, 5), 512new(2019, 06, 6), 513new(2019, 07, 7), 514new(2019, 08, 8), 515new(2019, 09, 9), 516new(2019, 10, 10), 517new(2019, 11, 11), 518new(2019, 12, 12), 1023DateTime lower = new(2019, 1, 30, 3, 4, 5, 6); 1024DateTime upper = new(2019, 2, 3, 4, 5, 6, 7); 1066TodayDate = new DateTime(2019, 1, 30, 3, 4, 5, 6) 1169MinDate = new DateTime(2019, 1, 2, 3, 4, 5, 6), 1170MaxDate = new DateTime(2020, 2, 3, 4, 5, 6, 7) 1313yield return new object[] { new DateTime(1753, 1, 1), new DateTime(1753, 1, 1), new DateTime(1753, 1, 1) }; 1314yield return new object[] { new DateTime(2019, 1, 29), new DateTime(2019, 1, 29), new DateTime(2019, 1, 29) }; 1315yield return new object[] { new DateTime(9998, 12, 31), new DateTime(9998, 12, 31), DateTime.Now.Date }; 1316yield return new object[] { new DateTime(9999, 1, 1), new DateTime(9998, 12, 31), DateTime.Now.Date }; 1317yield return new object[] { DateTime.MaxValue, new DateTime(9998, 12, 31), DateTime.Now.Date }; 1447yield return new object[] { DateTime.MinValue, new DateTime(1753, 1, 1), DateTime.Now.Date }; 1448yield return new object[] { new DateTime(1753, 1, 1), new DateTime(1753, 1, 1), DateTime.Now.Date }; 1449yield return new object[] { new DateTime(2019, 1, 29), new DateTime(2019, 1, 29), DateTime.Now.Date }; 1450yield return new object[] { new DateTime(9998, 12, 31), new DateTime(9998, 12, 31), new DateTime(9998, 12, 31) }; 1526yield return new object[] { new DateTime[] { new(2019, 01, 1), new(2019, 01, 20) }, new DateTime[] { new(2019, 01, 1), new(2019, 01, 20) } }; 1527yield return new object[] { new DateTime[] { new(2017, 01, 1), new(2018, 01, 20) }, new DateTime[] { new(2017, 01, 1), new(2018, 01, 20) } }; 1528yield return new object[] { new DateTime[] { new(2019, 01, 1), new(2019, 01, 1), new(2018, 01, 1) }, new DateTime[] { new(2019, 01, 1), new(2019, 01, 1), new(2018, 01, 1) } }; 1533new(2019, 01, 1), 1534new(2019, 02, 2), 1535new(2019, 03, 3), 1536new(2019, 04, 4), 1537new(2019, 05, 5), 1538new(2019, 06, 6), 1539new(2019, 07, 7), 1540new(2019, 08, 8), 1541new(2019, 09, 9), 1542new(2019, 10, 10), 1543new(2019, 11, 11), 1544new(2019, 12, 12), 1945yield return new object[] { DateTime.MinValue, new DateTime(1, 1, 7) }; 1946yield return new object[] { new DateTime(1753, 1, 1), new DateTime(1753, 1, 7) }; 1947yield return new object[] { new DateTime(1753, 1, 1).AddHours(1), new DateTime(1753, 1, 7).AddHours(1) }; 1948yield return new object[] { new DateTime(2019, 1, 29), new DateTime(2019, 2, 4) }; 1951yield return new object[] { new DateTime(9998, 12, 31), new DateTime(9998, 12, 31) }; 2012calendar.MinDate = new DateTime(2019, 10, 3); 2023calendar.MaxDate = new DateTime(2019, 9, 3); 2029yield return new object[] { new DateTime(1753, 1, 1), new DateTime(1753, 1, 1) }; 2030yield return new object[] { new DateTime(1753, 1, 1).AddHours(1), new DateTime(1753, 1, 1).AddHours(1) }; 2031yield return new object[] { new DateTime(2019, 1, 29), new DateTime(2019, 1, 29) }; 2034yield return new object[] { new DateTime(9998, 12, 31), new DateTime(9998, 12, 25) }; 2093calendar.MinDate = new DateTime(2019, 10, 3); 2103calendar.MaxDate = new DateTime(2019, 9, 3); 2110yield return new object[] { new SelectionRange(new DateTime(1753, 1, 1).AddTicks(-1), new DateTime(1753, 1, 1).AddTicks(-1)), new DateTime(1752, 12, 31), new DateTime(1752, 12, 31) }; 2111yield return new object[] { new SelectionRange(new DateTime(1753, 1, 1), new DateTime(1753, 1, 1)), new DateTime(1753, 1, 1), new DateTime(1753, 1, 1) }; 2112yield return new object[] { new SelectionRange(new DateTime(1753, 1, 1), new DateTime(1753, 1, 2)), new DateTime(1753, 1, 1), new DateTime(1753, 1, 2) }; 2114yield return new object[] { new SelectionRange(new DateTime(2019, 9, 1), new DateTime(2019, 9, 1)), new DateTime(2019, 9, 1), new DateTime(2019, 9, 1) }; 2115yield return new object[] { new SelectionRange(new DateTime(2019, 9, 1), new DateTime(2019, 9, 2)), new DateTime(2019, 9, 1), new DateTime(2019, 9, 2) }; 2116yield return new object[] { new SelectionRange(new DateTime(2019, 9, 1).AddHours(1), new DateTime(2019, 9, 2).AddHours(1)), new DateTime(2019, 9, 1), new DateTime(2019, 9, 2) }; 2117yield return new object[] { new SelectionRange(new DateTime(2019, 9, 2), new DateTime(2019, 9, 1)), new DateTime(2019, 9, 1), new DateTime(2019, 9, 2) }; 2118yield return new object[] { new SelectionRange(new DateTime(2019, 9, 1), new DateTime(2019, 9, 7)), new DateTime(2019, 9, 1), new DateTime(2019, 9, 7) }; 2119yield return new object[] { new SelectionRange(new DateTime(2019, 9, 1), new DateTime(2019, 9, 8)), new DateTime(2019, 9, 1), new DateTime(2019, 9, 7) }; 2128yield return new object[] { new SelectionRange(new DateTime(9998, 12, 30), new DateTime(9998, 12, 31)), new DateTime(9998, 12, 30), new DateTime(9998, 12, 31) }; 2129yield return new object[] { new SelectionRange(new DateTime(9998, 12, 31), new DateTime(9998, 12, 31)), new DateTime(9998, 12, 31), new DateTime(9998, 12, 31) }; 2130yield return new object[] { new SelectionRange(new DateTime(9998, 12, 31).AddTicks(1), new DateTime(9998, 12, 31).AddTicks(1)), new DateTime(9998, 12, 31), new DateTime(9998, 12, 31) }; 2208calendar.MinDate = new DateTime(2019, 10, 3); 2225calendar.MaxDate = new DateTime(2019, 9, 3); 2844yield return new object[] { new DateTime(1753, 1, 1).AddTicks(-1) }; 2845yield return new object[] { new DateTime(1753, 1, 1) }; 2846yield return new object[] { new DateTime(2019, 9, 1) }; 2847yield return new object[] { new DateTime(2019, 9, 1).AddHours(1) }; 2850yield return new object[] { new DateTime(9998, 12, 31) }; 2851yield return new object[] { new DateTime(9998, 12, 31).AddTicks(1) }; 2912calendar.MinDate = new DateTime(2019, 10, 3); 2923calendar.MaxDate = new DateTime(2019, 9, 3); 2990calendar.AddAnnuallyBoldedDate(new DateTime(2019, 10, 3)); 2995calendar.AddAnnuallyBoldedDate(new DateTime(2019, 10, 5)); 3000calendar.AddAnnuallyBoldedDate(new DateTime(2019, 09, 5)); 3005calendar.AddAnnuallyBoldedDate(new DateTime(2018, 09, 5)); 3010calendar.AddAnnuallyBoldedDate(new DateTime(2018, 09, 5)); 3016Assert.Equal(new DateTime[] { new(2019, 10, 3), new(2019, 10, 5), new(2019, 09, 5), new(2018, 09, 5), new(2018, 09, 5), DateTime.MinValue }, calendar.AnnuallyBoldedDates); 3021Assert.Equal(new DateTime[] { new(2019, 10, 3), new(2019, 10, 5), new(2019, 09, 5), new(2018, 09, 5), new(2018, 09, 5), DateTime.MinValue, DateTime.MaxValue }, calendar.AnnuallyBoldedDates); 3037calendar.AddAnnuallyBoldedDate(new DateTime(2019, 10, 3)); 3045calendar.AddAnnuallyBoldedDate(new DateTime(2019, 10, 5)); 3053calendar.AddAnnuallyBoldedDate(new DateTime(2019, 09, 5)); 3061calendar.AddAnnuallyBoldedDate(new DateTime(2018, 09, 5)); 3069calendar.AddAnnuallyBoldedDate(new DateTime(2018, 09, 5)); 3078Assert.Equal(new DateTime[] { new(2019, 10, 3), new(2019, 10, 5), new(2019, 09, 5), new(2018, 09, 5), new(2018, 09, 5), DateTime.MinValue }, calendar.AnnuallyBoldedDates); 3086Assert.Equal(new DateTime[] { new(2019, 10, 3), new(2019, 10, 5), new(2019, 09, 5), new(2018, 09, 5), new(2018, 09, 5), DateTime.MinValue, DateTime.MaxValue }, calendar.AnnuallyBoldedDates); 3097calendar.AddBoldedDate(new DateTime(2019, 10, 3)); 3102calendar.AddBoldedDate(new DateTime(2019, 10, 5)); 3107calendar.AddBoldedDate(new DateTime(2019, 09, 5)); 3112calendar.AddBoldedDate(new DateTime(2018, 09, 5)); 3117calendar.AddBoldedDate(new DateTime(2018, 09, 5)); 3123Assert.Equal(new DateTime[] { new(2019, 10, 3), new(2019, 10, 5), new(2019, 09, 5), new(2018, 09, 5), DateTime.MinValue }, calendar.BoldedDates); 3128Assert.Equal(new DateTime[] { new(2019, 10, 3), new(2019, 10, 5), new(2019, 09, 5), new(2018, 09, 5), DateTime.MinValue, DateTime.MaxValue }, calendar.BoldedDates); 3144calendar.AddBoldedDate(new DateTime(2019, 10, 3)); 3152calendar.AddBoldedDate(new DateTime(2019, 10, 5)); 3160calendar.AddBoldedDate(new DateTime(2019, 09, 5)); 3168calendar.AddBoldedDate(new DateTime(2018, 09, 5)); 3176calendar.AddBoldedDate(new DateTime(2018, 09, 5)); 3185Assert.Equal(new DateTime[] { new(2019, 10, 3), new(2019, 10, 5), new(2019, 09, 5), new(2018, 09, 5), DateTime.MinValue }, calendar.BoldedDates); 3193Assert.Equal(new DateTime[] { new(2019, 10, 3), new(2019, 10, 5), new(2019, 09, 5), new(2018, 09, 5), DateTime.MinValue, DateTime.MaxValue }, calendar.BoldedDates); 3204calendar.AddMonthlyBoldedDate(new DateTime(2019, 10, 3)); 3209calendar.AddMonthlyBoldedDate(new DateTime(2019, 10, 5)); 3214calendar.AddMonthlyBoldedDate(new DateTime(2019, 09, 5)); 3219calendar.AddMonthlyBoldedDate(new DateTime(2018, 09, 5)); 3224calendar.AddMonthlyBoldedDate(new DateTime(2018, 09, 5)); 3230Assert.Equal(new DateTime[] { new(2019, 10, 3), new(2019, 10, 5), new(2019, 09, 5), new(2018, 09, 5), new(2018, 09, 5), DateTime.MinValue }, calendar.MonthlyBoldedDates); 3235Assert.Equal(new DateTime[] { new(2019, 10, 3), new(2019, 10, 5), new(2019, 09, 5), new(2018, 09, 5), new(2018, 09, 5), DateTime.MinValue, DateTime.MaxValue }, calendar.MonthlyBoldedDates); 3251calendar.AddMonthlyBoldedDate(new DateTime(2019, 10, 3)); 3259calendar.AddMonthlyBoldedDate(new DateTime(2019, 10, 5)); 3267calendar.AddMonthlyBoldedDate(new DateTime(2019, 09, 5)); 3275calendar.AddMonthlyBoldedDate(new DateTime(2018, 09, 5)); 3283calendar.AddMonthlyBoldedDate(new DateTime(2018, 09, 5)); 3292Assert.Equal(new DateTime[] { new(2019, 10, 3), new(2019, 10, 5), new(2019, 09, 5), new(2018, 09, 5), new(2018, 09, 5), DateTime.MinValue }, calendar.MonthlyBoldedDates); 3300Assert.Equal(new DateTime[] { new(2019, 10, 3), new(2019, 10, 5), new(2019, 09, 5), new(2018, 09, 5), new(2018, 09, 5), DateTime.MinValue, DateTime.MaxValue }, calendar.MonthlyBoldedDates); 3953yield return new object[] { new DateTime(1753, 1, 1).AddTicks(-1) }; 3954yield return new object[] { new DateTime(1753, 1, 1) }; 3955yield return new object[] { new DateTime(2019, 9, 1) }; 3956yield return new object[] { new DateTime(2019, 9, 1).AddHours(1) }; 3959yield return new object[] { new DateTime(9998, 12, 31) }; 3960yield return new object[] { new DateTime(9998, 12, 31).AddTicks(1) }; 4028calendar.MinDate = new DateTime(2019, 10, 3); 4040calendar.MaxDate = new DateTime(2019, 9, 3); 4047yield return new object[] { new DateTime(1753, 1, 1).AddTicks(-1), new DateTime(1753, 1, 1).AddTicks(-1), new DateTime(1753, 1, 1).AddTicks(-1), new DateTime(1753, 1, 1).AddTicks(-1) }; 4048yield return new object[] { new DateTime(1753, 1, 1), new DateTime(1753, 1, 1), new DateTime(1753, 1, 1), new DateTime(1753, 1, 1) }; 4049yield return new object[] { new DateTime(1753, 1, 1), new DateTime(1753, 1, 2), new DateTime(1753, 1, 1), new DateTime(1753, 1, 2) }; 4051yield return new object[] { new DateTime(2019, 9, 1), new DateTime(2019, 9, 1), new DateTime(2019, 9, 1), new DateTime(2019, 9, 1) }; 4052yield return new object[] { new DateTime(2019, 9, 1), new DateTime(2019, 9, 2), new DateTime(2019, 9, 1), new DateTime(2019, 9, 2) }; 4053yield return new object[] { new DateTime(2019, 9, 1).AddHours(1), new DateTime(2019, 9, 2).AddHours(1), new DateTime(2019, 9, 1).AddHours(1), new DateTime(2019, 9, 2).AddHours(1) }; 4054yield return new object[] { new DateTime(2019, 9, 2), new DateTime(2019, 9, 1), new DateTime(2019, 9, 2), new DateTime(2019, 9, 2) }; 4055yield return new object[] { new DateTime(2019, 9, 1), new DateTime(2019, 9, 7), new DateTime(2019, 9, 1), new DateTime(2019, 9, 7) }; 4056yield return new object[] { new DateTime(2019, 9, 1), new DateTime(2019, 9, 8), new DateTime(2019, 9, 1), new DateTime(2019, 9, 7) }; 4065yield return new object[] { new DateTime(9998, 12, 30), new DateTime(9998, 12, 31), new DateTime(9998, 12, 30), new DateTime(9998, 12, 31) }; 4066yield return new object[] { new DateTime(9998, 12, 31), new DateTime(9998, 12, 31), new DateTime(9998, 12, 31), new DateTime(9998, 12, 31) }; 4067yield return new object[] { new DateTime(9998, 12, 31).AddTicks(1), new DateTime(9998, 12, 31).AddTicks(1), new DateTime(9998, 12, 31).AddTicks(1), new DateTime(9998, 12, 31).AddTicks(1) }; 4139calendar.MinDate = new DateTime(2019, 10, 3); 4156calendar.MaxDate = new DateTime(2019, 9, 3); 4167yield return new object[] { new DateTime(2021, 8, 31) }; // Make this date of the not fully visible previous month bold 4172yield return new object[] { new DateTime(2021, i, i) }; 4178yield return new object[] { new DateTime(2022, i, i) }; 4181yield return new object[] { new DateTime(2022, 9, 1) }; // Make this date of the not fully visible last month bold 4195calendar.SetSelectionRange(new DateTime(2021, 9, 1), new DateTime(2022, 8, 31)); 4200Assert.Equal(new DateTime(2021, 8, 29), displayRange.Start); 4201Assert.Equal(new DateTime(2022, 9, 10), displayRange.End); 4226yield return new object[] { new DateTime(2021, i, i), expectedIndex++ }; 4232yield return new object[] { new DateTime(2022, i, i), expectedIndex++ }; 4240DateTime startDate = new(2021, 8, 1); 4250DateTime startDate = new(2023, 1, 1); 4251DateTime endDate = new(2023, 12, 31); 4370monthCalendar.SelectionStart = new DateTime(2021, 6, 16); 4386DateTime startDate = new(2022, 10, 1); 4387DateTime endDate = new(2022, 10, 7); 4460calendar.AddAnnuallyBoldedDate(new DateTime(2022, 1, 1)); 4461calendar.AddAnnuallyBoldedDate(new DateTime(2022, 2, 2)); 4462calendar.AddBoldedDate(new DateTime(2022, 1, 1)); 4463calendar.AddBoldedDate(new DateTime(2022, 2, 2)); 4464calendar.AddMonthlyBoldedDate(new DateTime(2022, 1, 1)); 4465calendar.AddMonthlyBoldedDate(new DateTime(2022, 2, 2)); 4481typeof(MonthCalendar).GetMethod(methodName).Invoke(calendar, methodName.Contains("All") ? null : new object[] { new DateTime(2022, 1, 1) }); 4543calendar.TodayDate = new DateTime(2000, 1, 1); 4667calendar.MaxDate = new DateTime(2022, 12, 31); 4671calendar.MaxDate.Should().Be(new DateTime(9998, 12, 31));
System.Windows.Forms.UI.IntegrationTests (7)
MonthCalendarTests.cs (7)
13private static readonly DateTime s_currentDate = new(2021, 12, 1); 14private static readonly DateTime s_maxDate = new(2021, 12, 3, 18, 0, 0); 15private static readonly DateTime s_minDate = new(2021, 11, 30, 17, 0, 0); 58DateTime selectedDate = new(2020, 4, 10); 131DateTime givenDate = new(givenYear, givenMonth, givenDay); 132DateTime expectedDate = new(expectedYear, expectedMonth, expectedDay); 137Assert.Equal(new DateTime(givenYear, givenMonth, 1), calendar.GetDisplayRange(visible: true).Start);
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)
src\Microsoft.DotNet.Wpf\src\Shared\MS\Win32\NativeMethodsCLR.cs (1)
2154return new DateTime(longVal);
UnsupportedTypes (1)
CreateFrameworkTypes.cs (1)
231newRow2["orderDate"] = new DateTime(2001, i, j * 2);
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)
Calendar.Designer.cs (6)
58new System.DateTime(2021, 8, 1, 0, 0, 0, 0), 59new System.DateTime(2021, 8, 2, 0, 0, 0, 0)}; 61new System.DateTime(2021, 7, 3, 0, 0, 0, 0), 62new System.DateTime(2021, 7, 4, 0, 0, 0, 0)}; 65new System.DateTime(2021, 9, 5, 0, 0, 0, 0), 66new System.DateTime(2021, 9, 6, 0, 0, 0, 0)};
7259 references to DateTime
Aspire.Azure.Npgsql.EntityFrameworkCore.PostgreSQL.Tests (1)
tests\Aspire.Azure.Npgsql.Tests\FakeTokenCredential.cs (1)
31this(new AccessToken(useManagedIdentity ? ManagedIdentityToken : Token, DateTime.UtcNow))
Aspire.Azure.Npgsql.Tests (1)
FakeTokenCredential.cs (1)
31this(new AccessToken(useManagedIdentity ? ManagedIdentityToken : Token, DateTime.UtcNow))
Aspire.Dashboard (102)
artifacts\obj\Aspire.Dashboard\Debug\net8.0\opentelemetry\proto\collector\logs\v1\LogsServiceGrpc.cs (2)
143public virtual global::OpenTelemetry.Proto.Collector.Logs.V1.ExportLogsServiceResponse Export(global::OpenTelemetry.Proto.Collector.Logs.V1.ExportLogsServiceRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) 169public virtual grpc::AsyncUnaryCall<global::OpenTelemetry.Proto.Collector.Logs.V1.ExportLogsServiceResponse> ExportAsync(global::OpenTelemetry.Proto.Collector.Logs.V1.ExportLogsServiceRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
artifacts\obj\Aspire.Dashboard\Debug\net8.0\opentelemetry\proto\collector\metrics\v1\MetricsServiceGrpc.cs (2)
143public virtual global::OpenTelemetry.Proto.Collector.Metrics.V1.ExportMetricsServiceResponse Export(global::OpenTelemetry.Proto.Collector.Metrics.V1.ExportMetricsServiceRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) 169public virtual grpc::AsyncUnaryCall<global::OpenTelemetry.Proto.Collector.Metrics.V1.ExportMetricsServiceResponse> ExportAsync(global::OpenTelemetry.Proto.Collector.Metrics.V1.ExportMetricsServiceRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
artifacts\obj\Aspire.Dashboard\Debug\net8.0\opentelemetry\proto\collector\trace\v1\TraceServiceGrpc.cs (2)
143public virtual global::OpenTelemetry.Proto.Collector.Trace.V1.ExportTraceServiceResponse Export(global::OpenTelemetry.Proto.Collector.Trace.V1.ExportTraceServiceRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) 169public virtual grpc::AsyncUnaryCall<global::OpenTelemetry.Proto.Collector.Trace.V1.ExportTraceServiceResponse> ExportAsync(global::OpenTelemetry.Proto.Collector.Trace.V1.ExportTraceServiceRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
artifacts\obj\Aspire.Dashboard\Debug\net8.0\ResourceServiceGrpc.cs (6)
165public virtual global::Aspire.ResourceService.Proto.V1.ApplicationInformationResponse GetApplicationInformation(global::Aspire.ResourceService.Proto.V1.ApplicationInformationRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) 175public virtual grpc::AsyncUnaryCall<global::Aspire.ResourceService.Proto.V1.ApplicationInformationResponse> GetApplicationInformationAsync(global::Aspire.ResourceService.Proto.V1.ApplicationInformationRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) 185public virtual grpc::AsyncServerStreamingCall<global::Aspire.ResourceService.Proto.V1.WatchResourcesUpdate> WatchResources(global::Aspire.ResourceService.Proto.V1.WatchResourcesRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) 195public virtual grpc::AsyncServerStreamingCall<global::Aspire.ResourceService.Proto.V1.WatchResourceConsoleLogsUpdate> WatchResourceConsoleLogs(global::Aspire.ResourceService.Proto.V1.WatchResourceConsoleLogsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) 205public virtual global::Aspire.ResourceService.Proto.V1.ResourceCommandResponse ExecuteResourceCommand(global::Aspire.ResourceService.Proto.V1.ResourceCommandRequest 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::Aspire.ResourceService.Proto.V1.ResourceCommandResponse> ExecuteResourceCommandAsync(global::Aspire.ResourceService.Proto.V1.ResourceCommandRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
Components\Controls\Chart\ChartContainer.razor.cs (2)
183var endDate = DateTime.UtcNow;
Components\Controls\Chart\MetricTable.razor.cs (1)
282public required DateTimeOffset DateTime { get; set; }
Components\Pages\ConsoleLogs.razor.cs (5)
543private DateTime? GetFilteredDateFromRemove() 545DateTime? timestampFilterDate; 645var now = TimeProvider.GetUtcNow().UtcDateTime; 664var timestamp = DateTime.UtcNow;
ConsoleLogs\LogParser.cs (1)
32DateTime? timestamp = null;
Extensions\TimeProviderExtensions.cs (7)
10public static DateTime ToLocal(this BrowserTimeProvider timeProvider, DateTimeOffset utcDateTimeOffset) 12var dateTime = TimeZoneInfo.ConvertTimeFromUtc(utcDateTimeOffset.UtcDateTime, timeProvider.LocalTimeZone); 13dateTime = DateTime.SpecifyKind(dateTime, DateTimeKind.Local); 23public static DateTime ToLocal(this BrowserTimeProvider timeProvider, DateTime dateTime) 34var local = TimeZoneInfo.ConvertTimeFromUtc(dateTime, timeProvider.LocalTimeZone); 35local = DateTime.SpecifyKind(local, DateTimeKind.Local);
Model\ConsoleLogsFilters.cs (2)
8public DateTime? FilterAllLogsDate { get; set; } 9public Dictionary<string, DateTime> FilterResourceLogsDates { get; set; } = [];
Model\Otlp\TelemetryFilter.cs (4)
72private static Func<DateTime, DateTime, bool> ConditionToFuncDate(FilterCondition c) => 106var date = DateTime.Parse(Value, CultureInfo.InvariantCulture);
Model\PauseManager.cs (12)
12private DateTime? _metricsPausedAt; 13private DateTime? _tracesPausedAt; 14private DateTime? _structuredLogsPausedAt; 25public void SetMetricsPaused(bool isPaused) => _metricsPausedAt = isPaused ? DateTime.UtcNow : null; 27public bool AreMetricsPaused([NotNullWhen(true)] out DateTime? pausedAt) 33public void SetTracesPaused(bool isPaused) => _tracesPausedAt = isPaused ? DateTime.UtcNow : null; 35public bool AreTracesPaused([NotNullWhen(true)] out DateTime? pausedAt) 41public void SetStructuredLogsPaused(bool isPaused) => _structuredLogsPausedAt = isPaused ? DateTime.UtcNow : null; 43public bool AreStructuredLogsPaused([NotNullWhen(true)] out DateTime? pausedAt) 49public void SetConsoleLogsPaused(bool isPaused, DateTime timestamp) 72public sealed record PauseInterval(DateTime Start, DateTime? End);
Model\ResourceViewModel.cs (2)
304if (DateTime.TryParseExact(value, "o", CultureInfo.InvariantCulture, DateTimeStyles.None, out var date))
Model\TraceHelpers.cs (5)
28static void Visit(OtlpSpanCollection allSpans, OtlpSpan span, Func<OtlpSpan, TState, TState> spanAction, TState state, Func<OtlpSpan, DateTime> orderByFunc) 39private readonly record struct OrderedApplicationsState(DateTime? CurrentMinDate); 70private static void ProcessSpanApp(OtlpSpan span, OtlpApplication application, Dictionary<OtlpApplication, OrderedApplication> appFirstTimes, DateTime currentMinDate) 95public sealed class OrderedApplication(OtlpApplication application, int index, DateTime firstDateTime, int totalSpans, int erroredSpans) 99public DateTime FirstDateTime { get; set; } = firstDateTime;
Otlp\Model\MetricValues\DimensionScope.cs (7)
34var start = OtlpHelpers.UnixNanoSecondsToDateTime(d.StartTimeUnixNano); 35var end = OtlpHelpers.UnixNanoSecondsToDateTime(d.TimeUnixNano); 82var start = OtlpHelpers.UnixNanoSecondsToDateTime(h.StartTimeUnixNano); 83var end = OtlpHelpers.UnixNanoSecondsToDateTime(h.TimeUnixNano); 131var start = OtlpHelpers.UnixNanoSecondsToDateTime(exemplar.TimeUnixNano); 160internal static DimensionScope Clone(DimensionScope value, DateTime? valuesStart, DateTime? valuesEnd)
Otlp\Model\MetricValues\HistogramValue.cs (2)
16public HistogramValue(ulong[] values, double sum, ulong count, DateTime start, DateTime end, double[] explicitBounds) : base(start, end)
Otlp\Model\MetricValues\MetricValue.cs (2)
13public MetricValue(T value, DateTime start, DateTime end) : base(start, end)
Otlp\Model\MetricValues\MetricValueBase.cs (4)
15public DateTime Start { get; set; } 16public DateTime End { get; set; } 19protected MetricValueBase(DateTime start, DateTime end)
Otlp\Model\OtlpApplication.cs (2)
204public OtlpInstrument? GetInstrument(string meterName, string instrumentName, DateTime? valuesStart, DateTime? valuesEnd)
Otlp\Model\OtlpHelpers.cs (2)
169public static DateTime UnixNanoSecondsToDateTime(ulong unixTimeNanoseconds) 173return DateTime.UnixEpoch.AddTicks(ticks);
Otlp\Model\OtlpInstrument.cs (2)
108public static OtlpInstrument Clone(OtlpInstrument instrument, bool cloneData, DateTime? valuesStart, DateTime? valuesEnd)
Otlp\Model\OtlpLogEntry.cs (2)
14public DateTime TimeStamp { get; } 66private static DateTime ResolveTimeStamp(LogRecord record)
Otlp\Model\OtlpTrace.cs (3)
18public DateTime TimeStamp => FirstSpan.StartTime; 26DateTime end = default; 138DateTime current = default;
Otlp\Storage\GetInstrumentRequest.cs (2)
11public DateTime? StartTime { get; init; } 12public DateTime? EndTime { get; init; }
Otlp\Storage\Subscription.cs (3)
23private DateTime? _lastExecute; 58var s = lastExecute.Value.Add(minExecuteInterval) - DateTime.UtcNow; 66_lastExecute = DateTime.UtcNow;
Otlp\Storage\TelemetryRepository.cs (1)
1114DateTime current = default;
src\Shared\ChannelExtensions.cs (3)
30DateTime? lastRead = null; 40var s = lastRead.Value.Add(minReadInterval.Value) - DateTime.UtcNow; 56lastRead = DateTime.UtcNow;
src\Shared\ConsoleLogs\LogEntry.cs (5)
21public DateTime? Timestamp { get; private set; } 26public static LogEntry CreatePause(DateTime startTimestamp, DateTime? endTimestamp = null) 41public static LogEntry Create(DateTime? timestamp, string logMessage, bool isErrorMessage) 46public static LogEntry Create(DateTime? timestamp, string logMessage, string rawLogContent, bool isErrorMessage)
src\Shared\ConsoleLogs\LogPauseViewModel.cs (2)
18public DateTime? EndTime { get; set; } 21public bool Contains(DateTime timestamp) => timestamp >= StartTime && (EndTime is null || timestamp < EndTime);
Utils\FormatHelpers.cs (7)
74public static string FormatTime(BrowserTimeProvider timeProvider, DateTime value, MillisecondsDisplay millisecondsDisplay = MillisecondsDisplay.None, CultureInfo? cultureInfo = null) 77var local = timeProvider.ToLocal(value); 89public static string FormatDateTime(BrowserTimeProvider timeProvider, DateTime value, MillisecondsDisplay millisecondsDisplay = MillisecondsDisplay.None, CultureInfo? cultureInfo = null) 92var local = timeProvider.ToLocal(value); 104public static string FormatTimeWithOptionalDate(BrowserTimeProvider timeProvider, DateTime value, MillisecondsDisplay millisecondsDisplay = MillisecondsDisplay.None, CultureInfo? cultureInfo = null) 106var local = timeProvider.ToLocal(value); 109if (local.Date == DateTime.Now.Date)
Aspire.Dashboard.Components.Tests (18)
Pages\ConsoleLogsTests.cs (2)
458var pauseContent = $"{DateTime.UtcNow:yyyy-MM-ddTHH:mm:ss.fffK} Log while paused"; 482var resumeContent = $"{DateTime.UtcNow:yyyy-MM-ddTHH:mm:ss.fffK} Log after resume";
Pages\MetricsTests.cs (1)
27private static readonly DateTime s_testTime = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
Pages\TraceDetailsTests.cs (1)
33private static readonly DateTime s_testTime = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
tests\Shared\DashboardModel\ModelTestHelpers.cs (3)
33CreationTimeStamp = DateTime.UtcNow, 34StartTimeStamp = DateTime.UtcNow, 35StopTimeStamp = DateTime.UtcNow,
tests\Shared\Telemetry\TelemetryTestHelpers.cs (11)
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) 187public static LogRecord CreateLogRecord(DateTime? time = null, DateTime? observedTime = null, string? message = null, SeverityNumber? severity = null, IEnumerable<KeyValuePair<string, string>>? attributes = null, bool? skipBody = null) 276public static ulong DateTimeToUnixNanoseconds(DateTime dateTime) 278var unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); 304public static OtlpSpan CreateOtlpSpan(OtlpApplication app, OtlpTrace trace, OtlpScope scope, string spanId, string? parentSpanId, DateTime startDate, 312EndTime = DateTime.MaxValue,
Aspire.Dashboard.Tests (65)
ConsoleLogsTests\LogEntriesTests.cs (6)
212var timestamp = DateTime.UtcNow; 233var timestamp = DateTime.UtcNow; 253var timestamp = DateTime.UtcNow;
FormatHelpersTests.cs (8)
44var date = GetLocalDateTime(value); 56var date = GetLocalDateTime(value); 68var date = GetLocalDateTime(value); 80var date = GetLocalDateTime(value); 84private static DateTime GetLocalDateTime(string value) 86Assert.True(DateTime.TryParseExact(value, "o", CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind, out var date)); 88date = DateTime.SpecifyKind(date, DateTimeKind.Local);
Integration\DashboardClientAuthTests.cs (1)
184Resources = { new Resource() { Name = "resource1", ResourceType = "test", Uid = "resource1", CreatedAt = Timestamp.FromDateTime(DateTime.Now) } }
Model\DashboardClientTests.cs (1)
143CreatedAt = Timestamp.FromDateTime(DateTime.UtcNow),
Model\ResourceMenuItemsTests.cs (1)
19private static readonly DateTime s_testTime = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
Model\ResourceViewModelTests.cs (1)
16private static readonly DateTime s_dateTime = new(2000, 12, 30, 23, 59, 59, DateTimeKind.Utc);
TelemetryRepositoryTests\LogTests.cs (2)
21private static readonly DateTime s_testTime = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); 1236LogRecords = { CreateLogRecord(time: DateTime.UnixEpoch, observedTime: s_testTime.AddMinutes(1)) }
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 (1)
14private static readonly DateTime s_testTime = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
TelemetryRepositoryTests\TelemetryRepositoryTests.cs (10)
68CreateLogRecord(time: DateTime.Now, message: "1", severity: SeverityNumber.Error), 91CreateSumMetric(metricName: "test", startTime: DateTime.Now.AddMinutes(1)), 92CreateSumMetric(metricName: "test", startTime: DateTime.Now.AddMinutes(2)), 93CreateSumMetric(metricName: "test2", startTime: DateTime.Now.AddMinutes(1)), 101CreateSumMetric(metricName: "test", startTime: DateTime.Now.AddMinutes(1)), 102CreateHistogramMetric(metricName: "test2", startTime: DateTime.Now.AddMinutes(1)) 125CreateSpan(traceId: "1", spanId: "1-1", startTime: DateTime.Now.AddMinutes(1), endTime: DateTime.Now.AddMinutes(10)), 126CreateSpan(traceId: "1", spanId: "1-2", startTime: DateTime.Now.AddMinutes(5), endTime: DateTime.Now.AddMinutes(10), parentSpanId: "1-1")
TelemetryRepositoryTests\TraceTests.cs (4)
23private static readonly DateTime s_testTime = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); 907var testTime = s_testTime.AddDays(1); 916var startTime = testTime.AddMinutes(i + (i % 2 == 0 ? -5 : 0)); 960private static void AddTrace(TelemetryRepository repository, string traceId, DateTime startTime)
tests\Shared\DashboardModel\ModelTestHelpers.cs (3)
33CreationTimeStamp = DateTime.UtcNow, 34StartTimeStamp = DateTime.UtcNow, 35StopTimeStamp = DateTime.UtcNow,
tests\Shared\Telemetry\TelemetryTestHelpers.cs (11)
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) 187public static LogRecord CreateLogRecord(DateTime? time = null, DateTime? observedTime = null, string? message = null, SeverityNumber? severity = null, IEnumerable<KeyValuePair<string, string>>? attributes = null, bool? skipBody = null) 276public static ulong DateTimeToUnixNanoseconds(DateTime dateTime) 278var unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); 304public static OtlpSpan CreateOtlpSpan(OtlpApplication app, OtlpTrace trace, OtlpScope scope, string spanId, string? parentSpanId, DateTime startDate, 312EndTime = DateTime.MaxValue,
Aspire.EndToEnd.Tests (1)
tests\Shared\TemplatesTesting\TemplateCustomHive.cs (1)
54var dirWriteTime = Directory.GetLastWriteTimeUtc(_customHiveDirectory);
Aspire.Hosting (32)
ApplicationModel\CustomResourceSnapshot.cs (3)
39public DateTime? CreationTimeStamp { get; init; } 44public DateTime? StartTimeStamp { get; init; } 49public DateTime? StopTimeStamp { get; init; }
Dashboard\DashboardServiceData.cs (3)
34static GenericResourceSnapshot CreateResourceSnapshot(IResource resource, string resourceId, DateTime creationTimestamp, CustomResourceSnapshot snapshot) 57var timestamp = DateTime.UtcNow;
Dcp\DcpExecutor.cs (1)
465DateTime? timestamp = null;
Dcp\DcpExecutorEvents.cs (2)
9internal record ResourceStatus(string? State, DateTime? StartupTimestamp, DateTime? FinishedTimestamp);
Dcp\KubernetesService.cs (2)
429var currentTimestamp = DateTime.UtcNow;
Dcp\Model\Container.cs (2)
432public DateTime? StartupTimestamp { get; set; } 436public DateTime? FinishTimestamp { get; set; }
Dcp\Model\ContainerExec.cs (2)
62public DateTime? StartupTimestamp { get; set; } 68public DateTime? FinishTimestamp { get; set; }
Dcp\Model\Executable.cs (2)
131public DateTime? StartupTimestamp { get; set; } 137public DateTime? FinishTimestamp { get; set; }
Dcp\Model\ExecutableReplicaSet.cs (1)
81public DateTime? LastScaleTime { get; set; }
Dcp\Model\ModelCommon.cs (1)
419public DateTime? Timestamp { get; set; }
Orchestrator\ApplicationOrchestrator.cs (2)
282private async Task SetChildResourceAsync(IResource resource, string parentName, string? state, DateTime? startTimeStamp, DateTime? stopTimeStamp)
src\Shared\ChannelExtensions.cs (3)
30DateTime? lastRead = null; 40var s = lastRead.Value.Add(minReadInterval.Value) - DateTime.UtcNow; 56lastRead = DateTime.UtcNow;
src\Shared\ConsoleLogs\LogEntry.cs (5)
21public DateTime? Timestamp { get; private set; } 26public static LogEntry CreatePause(DateTime startTimestamp, DateTime? endTimestamp = null) 41public static LogEntry Create(DateTime? timestamp, string logMessage, bool isErrorMessage) 46public static LogEntry Create(DateTime? timestamp, string logMessage, string rawLogContent, bool isErrorMessage)
src\Shared\ConsoleLogs\LogPauseViewModel.cs (2)
18public DateTime? EndTime { get; set; } 21public bool Contains(DateTime timestamp) => timestamp >= StartTime && (EndTime is null || timestamp < EndTime);
Utils\ImageNameGenerator.cs (1)
21var bytes = Encoding.UTF8.GetBytes($"{builder.ApplicationBuilder.AppHostDirectory}{DateTime.UtcNow.Ticks}");
Aspire.Hosting.Azure (1)
Provisioning\Provisioners\BicepProvisioner.cs (1)
303CreationTimeStamp = DateTime.UtcNow,
Aspire.Hosting.Kubernetes (3)
Resources\ManagedFieldsEntryV1.cs (1)
61public DateTime? Time { get; set; }
Resources\ObjectMetaV1.cs (2)
108public DateTime? CreationTimestamp { get; set; } 120public DateTime? DeletionTimestamp { get; set; }
Aspire.Hosting.Tests (15)
Dashboard\DashboardLifecycleHookTests.cs (3)
29public async Task WatchDashboardLogs_WrittenToHostLoggerFactory(DateTime? timestamp, string logMessage, string expectedMessage, string expectedCategory, LogLevel expectedLevel) 217var timestamp = new DateTime(2001, 12, 29, 23, 59, 59, DateTimeKind.Utc); 229DateTime.UtcNow,
Health\ResourceHealthCheckServiceTests.cs (3)
432var giveUpAfter = DateTime.UtcNow.AddSeconds(5); 438if (DateTime.UtcNow > giveUpAfter)
ResourceNotificationTests.cs (2)
388var createdDate = DateTime.Now;
Utils\Grpc\TestServerCallContext.cs (1)
31protected override DateTime DeadlineCore { get; }
Utils\PeriodicRestartAsyncEnumerableTests.cs (6)
17var start = DateTime.UtcNow; 25if (DateTime.UtcNow - start > TimeSpan.FromSeconds(2)) 41var start = DateTime.UtcNow; 48if (DateTime.UtcNow - start > TimeSpan.FromSeconds(2))
Aspire.StackExchange.Redis (3)
src\Vendoring\OpenTelemetry.Instrumentation.StackExchangeRedis\Implementation\RedisProfilerEntryToActivityConverter.cs (3)
163var enqueued = command.CommandCreated.Add(command.CreationToEnqueued); 164var send = enqueued.Add(command.EnqueuedToSending); 165var response = send.Add(command.SentToResponse);
Aspire.Templates.Tests (2)
StarterTemplateRunTestsBase.cs (1)
138r => Assert.True(DateTime.TryParse(r, out _)),
tests\Shared\TemplatesTesting\TemplateCustomHive.cs (1)
54var dirWriteTime = Directory.GetLastWriteTimeUtc(_customHiveDirectory);
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)
Program.cs (1)
76return await connection.GetDatabase().StringSetAsync("Key", $"{DateTime.Now}");
BasicWebSite (4)
Controllers\TempDataController.cs (3)
52DateTime datetimeValue, 75var value4 = (DateTime)TempData["key4"];
Services\WeatherForecastService.cs (1)
19public async Task<WeatherForecast[]> GetForecastAsync(DateTime startDate)
BinaryFormatTests (10)
FormatTests\FormattedObject\BinaryFormatWriterTests.cs (2)
224new DateTime[] { DateTime.MaxValue }
FormatTests\FormattedObject\HashTableTests.cs (3)
212{ DateTime.MinValue, DateTime.MaxValue }, 268public DateTime ToDateTime(object value) => throw new NotImplementedException();
FormatTests\FormattedObject\ListTests.cs (2)
34DateTime.MaxValue, 107new List<DateTime>() { new(2000, 1, 1) },
FormatTests\FormattedObject\PrimitiveTypeTests.cs (3)
86{ (byte)PrimitiveType.DateTime, DateTime.MinValue }, 87{ (byte)PrimitiveType.DateTime, DateTime.MaxValue }, 136DateTime.MaxValue,
BlazorServerApp (2)
Data\WeatherForecast.cs (1)
8public DateTime Date { get; set; }
Data\WeatherForecastService.cs (1)
13public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate)
ClaimsTransformation (1)
ClaimsTransformer.cs (1)
21new Claim("Transformed", DateTime.Now.ToString(CultureInfo.InvariantCulture))
Client.ExpectedExceptions.IntegrationTests (18)
ExpectedExceptionTests.4.0.0.cs (9)
247DateTime endOfOpeningStall = DateTime.Now; 267DateTime startOfOpeningStall = DateTime.Now; 270endOfOpeningStall = DateTime.Now; 284endOfOpeningStall = DateTime.Now; 325DateTime startTime = DateTime.Now; 344double elapsedMs = (DateTime.Now - endOfOpeningStall).TotalMilliseconds;
ExpectedExceptionTests.4.1.0.cs (9)
497DateTime endOfOpeningStall = DateTime.Now; 517DateTime startOfOpeningStall = DateTime.Now; 520endOfOpeningStall = DateTime.Now; 534endOfOpeningStall = DateTime.Now; 575DateTime startTime = DateTime.Now; 594double elapsedMs = (DateTime.Now - endOfOpeningStall).TotalMilliseconds;
Contract.Message.IntegrationTests (9)
MessageContractCommon.4.1.0.cs (6)
53transaction.transactionDate = DateTime.Now; 83public DateTime transactionDate; 94public DateTime transactionDate; 105public DateTime transactionDate; 116public DateTime transactionDate; 129public DateTime transactionDate;
MessageContractTests.4.4.0.cs (1)
31requestData.transactionDate = DateTime.Now;
TestTypes.4.4.0.cs (2)
37public DateTime transactionDate; 68public DateTime transactionDate;
Contract.XmlSerializer.IntegrationTests (12)
XmlSerializerFormatTest.cs (12)
176var dateTime = DateTime.Now; 224var dateTime = DateTime.Now; 272var dateTime = DateTime.Now; 324var dateTime = DateTime.Now; 381var dateTime = DateTime.Now; 438var dateTime = DateTime.Now;
CustomPolicyProvider (4)
Authorization\MinimumAgeAuthorizationHandler.cs (3)
36var dateOfBirth = Convert.ToDateTime(dateOfBirthClaim.Value, CultureInfo.InvariantCulture); 37var age = DateTime.Now.Year - dateOfBirth.Year; 38if (dateOfBirth > DateTime.Now.AddYears(-age))
Controllers\AccountController.cs (1)
32if (DateTime.TryParse(birthDate, CultureInfo.InvariantCulture, out _))
dotnet-svcutil.xmlserializer.IntegrationTests (12)
src\System.Private.ServiceModel\tests\Scenarios\Contract\XmlSerializer\XmlSerializerFormatTest.cs (12)
176var dateTime = DateTime.Now; 224var dateTime = DateTime.Now; 272var dateTime = DateTime.Now; 324var dateTime = DateTime.Now; 381var dateTime = DateTime.Now; 438var dateTime = DateTime.Now;
dotnet-svcutil-lib (558)
CommandProcessorOptions.cs (1)
576var sessionDirName = DateTime.Now.ToString("yyyy_MMM_dd_HH_mm_ss", CultureInfo.InvariantCulture);
DebugLogger.cs (4)
78public async Task<DateTime> WriteStartOperationAsync(string message, bool logToUI = false) 80var startTime = DateTime.Now; 85public Task WriteEndOperationAsync(DateTime startTime, bool logToUI = false)
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\BinaryXml\XmlBinaryReader.cs (4)
1159public override DateTime ReadContentAsDateTime() 1162DateTime value; 3308Type TypeOfDateTime = typeof(System.DateTime); 3792private DateTime ValueAsDateTime()
FrameworkFork\Microsoft.Xml\Xml\Core\XmlAsyncCheckReader.cs (3)
252public override DateTime ReadContentAsDateTime() 324public override DateTime ReadElementContentAsDateTime() 330public override DateTime ReadElementContentAsDateTime(string localName, string namespaceURI)
FrameworkFork\Microsoft.Xml\Xml\Core\XmlAutoDetectWriter.cs (1)
231public override void WriteValue(DateTime value)
FrameworkFork\Microsoft.Xml\Xml\Core\XmlReader.cs (4)
241public virtual DateTime ReadContentAsDateTime() 446public virtual DateTime ReadElementContentAsDateTime() 450DateTime value = ReadContentAsDateTime(); 459public virtual DateTime ReadElementContentAsDateTime(string localName, string namespaceURI)
FrameworkFork\Microsoft.Xml\Xml\Core\XmlSubtreeReader.cs (2)
683public override DateTime ReadContentAsDateTime() 688DateTime value = reader.ReadContentAsDateTime();
FrameworkFork\Microsoft.Xml\Xml\Core\XmlWellformedWriter.cs (1)
1424public override void WriteValue(DateTime value)
FrameworkFork\Microsoft.Xml\Xml\Core\XmlWrappingWriter.cs (1)
209public override void WriteValue(DateTime value)
FrameworkFork\Microsoft.Xml\Xml\Core\XmlWriter.cs (1)
298public virtual void WriteValue(DateTime value)
FrameworkFork\Microsoft.Xml\Xml\Core\XsdValidatingReader.cs (2)
478public override DateTime ReadContentAsDateTime() 797public override DateTime ReadElementContentAsDateTime()
FrameworkFork\Microsoft.Xml\Xml\schema\DatatypeImplementation.cs (9)
2023private static readonly Type s_atomicValueType = typeof(DateTime); 2024private static readonly Type s_listValueType = typeof(DateTime[]); 2067DateTime dateTime1 = (DateTime)value1; 2068DateTime dateTime2 = (DateTime)value2; 2092DateTime dateTimeValue = DateTime.MinValue; 2095dateTimeValue = (DateTime)dateTime;
FrameworkFork\Microsoft.Xml\Xml\schema\FacetChecker.cs (9)
810internal virtual Exception CheckValueFacets(DateTime value, XmlSchemaDatatype datatype) 1283DateTime dateTimeValue = datatype.ValueConverter.ToDateTime(value); 1287internal override Exception CheckValueFacets(DateTime value, XmlSchemaDatatype datatype) 1294if (datatype.Compare(value, (DateTime)restriction.MaxInclusive) > 0) 1302if (datatype.Compare(value, (DateTime)restriction.MaxExclusive) >= 0) 1310if (datatype.Compare(value, (DateTime)restriction.MinInclusive) < 0) 1318if (datatype.Compare(value, (DateTime)restriction.MinExclusive) <= 0) 1338private bool MatchEnumeration(DateTime value, ArrayList enumeration, XmlSchemaDatatype datatype) 1342if (datatype.Compare(value, (DateTime)enumeration[i]) == 0)
FrameworkFork\Microsoft.Xml\Xml\schema\GenerateConverter.cs (1)
22public static Type[] InterfaceTypes = { typeof(Boolean), typeof(DateTime), typeof(Decimal), typeof(Double), typeof(Int32), typeof(Int64), typeof(Single), typeof(String), typeof(Object) };
FrameworkFork\Microsoft.Xml\Xml\schema\XmlAtomicValue.cs (3)
37[FieldOffset(0)] public DateTime dtVal; 88internal XmlAtomicValue(XmlSchemaType xmlType, DateTime value) 251public override DateTime ValueAsDateTime
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\CodeGenerator.cs (2)
1184ConstructorInfo DateTime_ctor = typeof(DateTime).GetConstructor(new Type[] { typeof(Int64) }); 1185Ldc(((DateTime)o).Ticks); // ticks
FrameworkFork\Microsoft.Xml\Xml\Serialization\PrimitiveXmlSerializers.cs (1)
108WriteElementStringRaw(@"dateTime", @"", FromDateTime(((System.DateTime)o)));
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\Serialization\XmlCodeExporter.cs (4)
281else if (type == typeof(DateTime)) 283DateTime dt = (DateTime)value; 304initExpression = new CodeObjectCreateExpression(new CodeTypeReference(typeof(DateTime)), new CodeExpression[] { new CodePrimitiveExpression(ticks) });
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlCountingReader.cs (3)
122public override DateTime ReadContentAsDateTime() 172public override DateTime ReadElementContentAsDateTime() 177public override DateTime ReadElementContentAsDateTime(string localName, string namespaceURI)
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlCustomFormatter.cs (13)
25if (type == typeof(DateTime)) 29return FromDateTime((DateTime)value); 33return FromDate((DateTime)value); 37return FromTime((DateTime)value); 62internal static string FromDate(DateTime value) 67internal static string FromTime(DateTime value) 69return XmlConvert.ToString(DateTime.MinValue + value.TimeOfDay, "HH:mm:ss.fffffffzzzzzz"); 72internal static string FromDateTime(DateTime value) 327internal static DateTime ToDateTime(string value) 332internal static DateTime ToDateTime(string value, string[] formats) 337internal static DateTime ToDate(string value) 342internal static DateTime ToTime(string value) 344return DateTime.ParseExact(value, s_allTimeFormats, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AllowLeadingWhite | DateTimeStyles.AllowTrailingWhite | DateTimeStyles.NoCurrentDateDefault);
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializationReader.cs (12)
343return typeof(DateTime); 347return typeof(DateTime); 349return typeof(DateTime); 411return typeof(DateTime); 415return typeof(DateTime); 417return typeof(DateTime); 759value = default(Nullable<DateTime>); 763value = default(Nullable<DateTime>); 765value = default(Nullable<DateTime>); 1140protected static DateTime ToDateTime(string value) 1146protected static DateTime ToDate(string value) 1152protected static DateTime ToTime(string value)
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializationWriter.cs (5)
124protected static string FromDateTime(DateTime value) 130protected static string FromDate(DateTime value) 136protected static string FromTime(DateTime value) 293value = FromDateTime((DateTime)o); 3580Writer.Write(((DateTime)value).Ticks.ToString());
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\Microsoft.Xml\Xml\XPath\XPathItem.cs (1)
36public abstract DateTime ValueAsDateTime { get; }
FrameworkFork\Microsoft.Xml\Xml\XPath\XPathNavigator.cs (1)
237public override DateTime ValueAsDateTime
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\DateTimeOffsetAdapter.cs (4)
20private DateTime _utcDateTime; 23public DateTimeOffsetAdapter(DateTime dateTime, short offsetMinutes) 30public DateTime UtcDateTime 33set { _utcDateTime = DateTime.SpecifyKind(value, DateTimeKind.Utc); }
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\PrimitiveDataContract.cs (2)
589public DateTimeDataContract() : base(typeof(DateTime), DictionaryGlobals.DateTimeLocalName, DictionaryGlobals.SchemaNamespace) 598writer.WriteDateTime((DateTime)obj);
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\TypeCode.cs (1)
67else if (type == typeof(DateTime))
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\XmlReaderDelegator.cs (3)
369internal virtual DateTime ReadElementContentAsDateTime() 675int arrayLength, out DateTime[] array) 686array = new DateTime[arrayLength];
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\XmlSerializableReader.cs (1)
117public override DateTime ReadContentAsDateTime() { return InnerReader.ReadContentAsDateTimeOffset().DateTime; }
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\XmlWriterDelegator.cs (4)
330WriteDateTime((DateTime)value); 393internal virtual void WriteDateTime(DateTime value) 401internal void WriteDateTime(DateTime value, XmlDictionaryString name, XmlDictionaryString ns) 680internal void WriteDateTimeArray(DateTime[] value, XmlDictionaryString itemName, XmlDictionaryString itemNamespace)
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\ValueHandle.cs (2)
194return typeof(DateTime); 387public DateTime ToDateTime()
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBaseReader.cs (5)
1535public override DateTime ReadContentAsDateTime() 1540DateTime value = node.Value.ToDateTime(); 1658else if (type == typeof(DateTime)) 1818public override DateTime[] ReadDateTimeArray(string localName, string namespaceUri) 1823public override DateTime[] ReadDateTimeArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBaseWriter.cs (3)
1180else if (value is DateTime) 1182WriteValue((DateTime)value); 1350public override void WriteValue(DateTime value)
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\XmlBufferReader.cs (2)
464public DateTime ReadDateTime() 470return DateTime.FromBinary(value);
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlConverter.cs (14)
236static public DateTime ToDateTime(Int64 value) 240return DateTime.FromBinary(value); 248static public DateTime ToDateTime(string value) 264static public DateTime ToDateTime(byte[] buffer, int offset, int count) 266DateTime value; 429static public string ToString(DateTime value) 456else if (value is DateTime) 457return ToString((DateTime)value); 882private static bool TryParseDateTime(byte[] chars, int offset, int count, out DateTime result) 885result = DateTime.MaxValue; 969DateTime value; 988if (hourDelta >= 0 && (value < DateTime.MaxValue - ts) || 989hourDelta < 0 && (value > DateTime.MinValue - ts)) 1079static public int ToChars(DateTime value, byte[] chars, int offset)
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.Runtime.Serialization\System\Xml\XmlNodeWriter.cs (1)
85public abstract void WriteDateTimeText(DateTime value);
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlUTF8TextWriter.cs (1)
687public override void WriteDateTimeText(DateTime value)
FrameworkFork\System.ServiceModel\Extensions\ReflectionExtensions.cs (1)
158if (type == typeof(DateTime))
FrameworkFork\System.ServiceModel\Internals\System\Runtime\Diagnostics\DiagnosticTraceBase.cs (2)
38this.LastFailure = DateTime.MinValue; 41protected DateTime LastFailure { get; set; }
FrameworkFork\System.ServiceModel\Internals\System\Runtime\Ticks.cs (1)
17return DateTime.UtcNow.Ticks;
FrameworkFork\System.ServiceModel\Internals\System\Runtime\TimeoutHelper.cs (13)
21private DateTime _deadline; 30_deadline = DateTime.MaxValue; 119public static DateTime Add(DateTime time, TimeSpan timeout) 121if (timeout >= TimeSpan.Zero && DateTime.MaxValue - time <= timeout) 123return DateTime.MaxValue; 125if (timeout <= TimeSpan.Zero && DateTime.MinValue - time >= timeout) 127return DateTime.MinValue; 132public static DateTime Subtract(DateTime time, TimeSpan timeout) 154else if (_deadline == DateTime.MaxValue) 160TimeSpan remaining = _deadline - DateTime.UtcNow; 180_deadline = DateTime.UtcNow + _originalTimeout;
FrameworkFork\System.ServiceModel\System\IdentityModel\Claims\X509CertificateClaimSet.cs (2)
17private DateTime _expirationTime = SecurityUtils.MinUtcDateTime; 80public DateTime ExpirationTime
FrameworkFork\System.ServiceModel\System\IdentityModel\Policy\AuthorizationContext.cs (1)
16public abstract DateTime ExpirationTime { get; }
FrameworkFork\System.ServiceModel\System\IdentityModel\Policy\DefaultAuthorizationContext.cs (2)
16private DateTime _expirationTime; 51public override DateTime ExpirationTime
FrameworkFork\System.ServiceModel\System\IdentityModel\Policy\DefaultEvaluationContext.cs (3)
17private DateTime _expirationTime = SecurityUtils.MaxUtcDateTime; 52public DateTime ExpirationTime 69public override void RecordExpirationTime(DateTime expirationTime)
FrameworkFork\System.ServiceModel\System\IdentityModel\Policy\EvaluationContext.cs (1)
17public abstract void RecordExpirationTime(DateTime expirationTime);
FrameworkFork\System.ServiceModel\System\IdentityModel\Policy\UnconditionalPolicy.cs (7)
24private DateTime _expirationTime; 34public UnconditionalPolicy(ClaimSet issuance, DateTime expirationTime) 42public UnconditionalPolicy(ReadOnlyCollection<ClaimSet> issuances, DateTime expirationTime) 56internal UnconditionalPolicy(IIdentity primaryIdentity, ClaimSet issuance, DateTime expirationTime) 62internal UnconditionalPolicy(IIdentity primaryIdentity, ReadOnlyCollection<ClaimSet> issuances, DateTime expirationTime) 84private void Initialize(ClaimSet issuer, ClaimSet issuance, ReadOnlyCollection<ClaimSet> issuances, DateTime expirationTime) 175public DateTime ExpirationTime
FrameworkFork\System.ServiceModel\System\IdentityModel\SecurityUtils.cs (6)
46public static DateTime MaxUtcDateTime 51return new DateTime(DateTime.MaxValue.Ticks - TimeSpan.TicksPerDay, DateTimeKind.Utc); 55public static DateTime MinUtcDateTime 60return new DateTime(DateTime.MinValue.Ticks + TimeSpan.TicksPerDay, DateTimeKind.Utc); 124internal static ReadOnlyCollection<IAuthorizationPolicy> CreateAuthorizationPolicies(ClaimSet claimSet, DateTime expirationTime) 427public override DateTime ExpirationTime { get { return _policy.ExpirationTime; } }
FrameworkFork\System.ServiceModel\System\IdentityModel\Tokens\KerberosRequestorSecurityToken.cs (4)
19private DateTime _effectiveTime; 20private DateTime _expirationTime; 57public override DateTime ValidFrom 62public override DateTime ValidTo
FrameworkFork\System.ServiceModel\System\IdentityModel\Tokens\SamlSecurityToken.cs (2)
64public override DateTime ValidFrom 72public override DateTime ValidTo
FrameworkFork\System.ServiceModel\System\IdentityModel\Tokens\SecurityToken.cs (2)
14public abstract DateTime ValidFrom { get; } 15public abstract DateTime ValidTo { get; }
FrameworkFork\System.ServiceModel\System\IdentityModel\Tokens\UserNameSecurityToken.cs (4)
15private DateTime _effectiveTime; 34_effectiveTime = DateTime.UtcNow; 47public override DateTime ValidFrom 52public override DateTime ValidTo
FrameworkFork\System.ServiceModel\System\IdentityModel\Tokens\WindowsSecurityToken.NetNative.cs (2)
31public override DateTime ValidFrom 39public override DateTime ValidTo
FrameworkFork\System.ServiceModel\System\IdentityModel\Tokens\X509SecurityToken.cs (4)
17private DateTime _effectiveTime = SecurityUtils.MaxUtcDateTime; 18private DateTime _expirationTime = SecurityUtils.MinUtcDateTime; 82public override DateTime ValidFrom 93public override DateTime ValidTo
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\DnsCache.cs (5)
79DateTime now = DateTime.UtcNow; 174private DateTime _timeStamp; 177public DnsCacheEntry(IPAddress[] addressList, DateTime timeStamp) 191public DateTime TimeStamp
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\IdlingCommunicationPool.cs (11)
151_connectionMapping[connection].LastUsage = DateTime.UtcNow; 161DateTime now = DateTime.UtcNow; 253DateTime now = DateTime.UtcNow; 289private bool IdleOutConnection(TItem connection, DateTime now) 346private DateTime _creationTime; 347private DateTime _lastUsage; 351_creationTime = DateTime.UtcNow; 355public DateTime CreationTime 360public DateTime LastUsage
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\SocketConnection.cs (4)
557DateTime connectStartTime = DateTime.UtcNow; 609DateTime connectStartTime = DateTime.UtcNow;
FrameworkFork\System.ServiceModel\System\ServiceModel\Diagnostics\TraceUtility.cs (1)
75TimeSpan elapsedTime = new TimeSpan(DateTime.UtcNow.Ticks - startTicks);
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\PrimitiveOperationFormatter.cs (4)
698value = Array.Empty<DateTime>(); 824DateTime[] arrayValue = (DateTime[])value; 870writer.WriteValue((DateTime)value);
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\SyncMethodInvoker.cs (1)
99beginOperation = DateTime.UtcNow.Ticks;
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\TaskMethodInvoker.cs (1)
158beginOperation = DateTime.UtcNow.Ticks;
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\InMemoryNonceCache.cs (2)
71DateTime expirationTime = TimeoutHelper.Add(DateTime.UtcNow, _cachingTimeSpan);
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\ISspiNegotiation.cs (1)
14DateTime ExpirationTimeUtc
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\RequestSecurityTokenResponse.cs (12)
30private DateTime _effectiveTime; 31private DateTime _expirationTime; 61DateTime validFrom, 62DateTime validTo, 88DateTime validFrom, 89DateTime validTo, 130DateTime validFrom, 131DateTime validTo, 215public DateTime ValidFrom 223public DateTime ValidTo 432public void SetLifetime(DateTime validFrom, DateTime validTo)
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\SecurityTimestamp.cs (11)
19private DateTime _creationTimeUtc; 20private DateTime _expiryTimeUtc; 25public SecurityTimestamp(DateTime creationTimeUtc, DateTime expiryTimeUtc, string id) 30internal SecurityTimestamp(DateTime creationTimeUtc, DateTime expiryTimeUtc, string id, string digestAlgorithm, byte[] digest) 48public DateTime CreationTimeUtc 56public DateTime ExpiryTimeUtc 103private static char[] ToChars(ref DateTime utcTime) 173DateTime now = DateTime.UtcNow;
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\SecurityUtils.cs (4)
253public static DateTime MaxUtcDateTime 258return new DateTime(DateTime.MaxValue.Ticks - TimeSpan.TicksPerDay, DateTimeKind.Utc); 262public static DateTime MinUtcDateTime 267return new DateTime(DateTime.MinValue.Ticks + TimeSpan.TicksPerDay, DateTimeKind.Utc);
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\TimeBoundedCache.cs (13)
21private DateTime _nextPurgeTimeUtc; 36_nextPurgeTimeUtc = DateTime.UtcNow.Add(_purgeInterval); 83protected bool TryAddItem(object key, object item, DateTime expirationTime, bool replaceExistingEntry) 152protected bool TryReplaceItem(object key, object item, DateTime expirationTime) 344Fx.Assert(item.ExpirationTime == DateTime.MaxValue || item.ExpirationTime.Kind == DateTimeKind.Utc, ""); 345return (item.ExpirationTime <= DateTime.UtcNow); 354else if (_purgingMode == PurgingMode.AccessBasedPurge && DateTime.UtcNow > _nextPurgeTimeUtc && this.Count > _lowWaterMark) 405_nextPurgeTimeUtc = DateTime.UtcNow.Add(_purgeInterval); 450DateTime ExpirationTime { get; } 494private DateTime _expirationTime; 497public ExpirableItem(object item, DateTime expirationTime) 500Fx.Assert(expirationTime == DateTime.MaxValue || expirationTime.Kind == DateTimeKind.Utc, ""); 504public DateTime ExpirationTime { get { return _expirationTime; } }
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\Tokens\BinarySecretSecurityToken.cs (5)
16private DateTime _effectiveTime; 51_effectiveTime = DateTime.UtcNow; 69public override DateTime ValidFrom 74public override DateTime ValidTo 77get { return DateTime.MaxValue; }
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\Tokens\DerivedKeySecurityToken.cs (2)
57public override DateTime ValidFrom 62public override DateTime ValidTo
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\Tokens\GenericXmlSecurityToken.cs (6)
28private DateTime _effectiveTime; 29private DateTime _expirationTime; 34DateTime effectiveTime, 35DateTime expirationTime, 62public override DateTime ValidFrom 67public override DateTime ValidTo
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\Tokens\ISecurityContextSecurityTokenCache.cs (1)
19void UpdateContextCachingTime(SecurityContextSecurityToken context, DateTime expirationTime);
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\Tokens\SecurityContextCookieSerializer.cs (4)
36public byte[] CreateCookieFromSecurityContext(UniqueId contextId, string id, byte[] key, DateTime tokenEffectiveTime, 37DateTime tokenExpirationTime, UniqueId keyGeneration, DateTime keyEffectiveTime, DateTime keyExpirationTime,
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)
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\Tokens\SspiSecurityToken.cs (6)
20private readonly DateTime _effectiveTime; 21private readonly DateTime _expirationTime; 28_effectiveTime = DateTime.UtcNow; 37_effectiveTime = DateTime.UtcNow; 51public override DateTime ValidFrom 56public override DateTime ValidTo
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\Tokens\WrappedKeySecurityToken.cs (5)
19private DateTime _effectiveTime; 91_effectiveTime = DateTime.UtcNow; 102public override DateTime ValidFrom 107public override DateTime ValidTo 110get { return DateTime.MaxValue; }
FrameworkFork\System.ServiceModel\System\ServiceModel\XmlUtil.cs (3)
125public static DateTime ReadElementContentAsDateTime(this XmlDictionaryReader reader) 128DateTime value; 135value = DateTime.Parse(string.Empty, NumberFormatInfo.InvariantInfo);
Shared\Utilities\ILogger.cs (2)
17Task<DateTime> WriteStartOperationAsync(string message, bool logToUI = false); 18Task WriteEndOperationAsync(DateTime startTime, bool logToUI = false);
Shared\Utilities\SafeLogger.cs (9)
13private DateTime _startTime = DateTime.MinValue; 23public static string GetStartOperationMessage(string message, DateTime startTime) 29public static string GetEndOperationMessage(DateTime startTime) 31return $"[{Process.GetCurrentProcess().Id}.{startTime.Millisecond}] Time elapsed: {DateTime.Now - startTime}"; 69public Task<DateTime> WriteStartOperationAsync(string message, bool logToUI = false) 75return Task.FromResult(DateTime.Now); 78public Task WriteEndOperationAsync(DateTime startTime, bool logToUI = false) 95if (disposing && this.logger != null && _startTime != DateTime.MinValue)
dotnet-svcutil-lib.Tests (3)
TestLogger.cs (3)
27public Task WriteEndOperationAsync(DateTime startTime, bool logToUI = false) 47public Task<DateTime> WriteStartOperationAsync(string message, bool logToUI = false) 50return Task.FromResult(DateTime.Now);
dotnet-user-jwts (8)
Commands\CreateCommand.cs (5)
151var notBefore = DateTime.UtcNow; 162var expiresOn = notBefore.AddMonths(3); 233static bool ParseDate(string datetime, out DateTime parsedDateTime) => 234DateTime.TryParseExact(datetime, _dateTimeFormats, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal, out parsedDateTime);
Helpers\JwtCreatorOptions.cs (2)
11DateTime NotBefore, 12DateTime ExpiresOn,
Helpers\JwtIssuer.cs (1)
60var jwtToken = handler.CreateJwtSecurityToken(Issuer, audience: null, identity, options.NotBefore, options.ExpiresOn, issuedAt: DateTime.UtcNow, jwtSigningCredentials);
Extensibility.MessageInterceptor.IntegrationTests (13)
TimeoutHelper.cs (13)
15private DateTime _deadline; 28this._deadline = DateTime.MaxValue; 32this._deadline = DateTime.UtcNow + timeout; 43if (this._deadline == DateTime.MaxValue) 49TimeSpan remaining = this._deadline - DateTime.UtcNow; 99public static DateTime Add(DateTime time, TimeSpan timeout) 101if (timeout >= TimeSpan.Zero && DateTime.MaxValue - time <= timeout) 103return DateTime.MaxValue; 105if (timeout <= TimeSpan.Zero && DateTime.MinValue - time >= timeout) 107return DateTime.MinValue; 112public static DateTime Subtract(DateTime time, TimeSpan timeout)
HelixTestRunner (2)
ProcessUtil.cs (2)
211public static void PrintMessage(string message) => Console.WriteLine($"{DateTime.UtcNow.ToString("O", CultureInfo.InvariantCulture)} {message}"); 212public static void PrintErrorMessage(string message) => Console.Error.WriteLine($"{DateTime.UtcNow.ToString("O", CultureInfo.InvariantCulture)} {message}");
HostedBlazorWebassemblyApp.Client (1)
Data\HttpWeatherForecastService.cs (1)
23public async Task<WeatherForecast[]> GetForecastAsync(DateTime startDate)
HostedBlazorWebassemblyApp.Server (2)
Controllers\WeatherForecastController.cs (1)
28return _forecastService.GetForecastAsync(DateTime.Now);
Data\WeatherForecastService.cs (1)
19public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate)
HostedBlazorWebassemblyApp.Shared (2)
IWeatherForecastService.cs (1)
14Task<WeatherForecast[]> GetForecastAsync(DateTime startDate);
WeatherForecast.cs (1)
12public DateTime Date { get; set; }
HtmlGenerationWebSite (1)
Models\Order.cs (1)
26public DateTime ShippingDateTime
HttpStress (1)
Program.cs (1)
547Console.Write("[" + DateTime.Now + "]");
IdeCoreBenchmarks (39)
ClassificationBenchmarks.cs (3)
80var start = DateTime.Now; 82Console.WriteLine("Finished opening roslyn: " + (DateTime.Now - start));
FindReferencesBenchmarks.cs (8)
77var start = DateTime.Now; 79Console.WriteLine("Finished opening roslyn: " + (DateTime.Now - start)); 95start = DateTime.Now; 97Console.WriteLine("Time to get first compilation: " + (DateTime.Now - start)); 107var start = DateTime.Now; 109Console.WriteLine("Time to find-refs: " + (DateTime.Now - start));
IncrementalSourceGeneratorBenchmarks.cs (10)
85var start = DateTime.Now; 88Console.WriteLine("Finished opening roslyn: " + (DateTime.Now - start)); 147var start = DateTime.Now; 150Console.WriteLine("Compilation time: " + (DateTime.Now - start)); 153start = DateTime.Now; 156Console.WriteLine("First generator run: " + (DateTime.Now - start)); 173start = DateTime.Now; 175var incrementalTime = DateTime.Now - start;
NavigateToBenchmarks.cs (18)
82var start = DateTime.Now; 85Console.WriteLine("Finished opening roslyn: " + (DateTime.Now - start)); 109var start = DateTime.Now; 120Console.WriteLine("Serial: " + (DateTime.Now - start)); 144var start = DateTime.Now; 153Console.WriteLine("Serial: " + (DateTime.Now - start)); 163var start = DateTime.Now; 174Console.WriteLine("Project parallel: " + (DateTime.Now - start)); 189var start = DateTime.Now; 202Console.WriteLine("Solution parallel: " + (DateTime.Now - start)); 213var start = DateTime.Now; 223Console.WriteLine("Time to search: " + (DateTime.Now - start));
Identity.ExternalClaims (1)
Startup.cs (1)
54tokens.Add(new AuthenticationToken() { Name = "TicketCreated", Value = DateTime.UtcNow.ToString(CultureInfo.InvariantCulture) });
IIS.FunctionalTests (6)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\EventLogHelpers.cs (1)
105var processStartTime = deploymentResult.HostProcess.StartTime.AddSeconds(-10);
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (1)
199var startTime = deploymentResult.HostProcess.StartTime.ToUniversalTime();
src\Servers\IIS\IIS\test\Common.FunctionalTests\LoggingTests.cs (4)
359var time = DateTime.Parse(prefixMatch.Groups[1].Value, CultureInfo.InvariantCulture).ToUniversalTime(); 366Assert.True(DateTime.UtcNow > time); 368Assert.True(DateTime.UtcNow.AddHours(-2) < time);
IIS.LongTests (3)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\EventLogHelpers.cs (1)
105var processStartTime = deploymentResult.HostProcess.StartTime.AddSeconds(-10);
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (1)
199var startTime = deploymentResult.HostProcess.StartTime.ToUniversalTime();
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (1)
1524var processStartTime = deploymentResult.HostProcess.StartTime.AddSeconds(-5);
IIS.NewHandler.FunctionalTests (3)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\EventLogHelpers.cs (1)
105var processStartTime = deploymentResult.HostProcess.StartTime.AddSeconds(-10);
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (1)
199var startTime = deploymentResult.HostProcess.StartTime.ToUniversalTime();
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (1)
1524var processStartTime = deploymentResult.HostProcess.StartTime.AddSeconds(-5);
IIS.NewShim.FunctionalTests (3)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\EventLogHelpers.cs (1)
105var processStartTime = deploymentResult.HostProcess.StartTime.AddSeconds(-10);
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (1)
199var startTime = deploymentResult.HostProcess.StartTime.ToUniversalTime();
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (1)
1524var processStartTime = deploymentResult.HostProcess.StartTime.AddSeconds(-5);
IIS.ShadowCopy.Tests (2)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\EventLogHelpers.cs (1)
105var processStartTime = deploymentResult.HostProcess.StartTime.AddSeconds(-10);
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (1)
199var startTime = deploymentResult.HostProcess.StartTime.ToUniversalTime();
IISExpress.FunctionalTests (7)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\EventLogHelpers.cs (1)
105var processStartTime = deploymentResult.HostProcess.StartTime.AddSeconds(-10);
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (1)
199var startTime = deploymentResult.HostProcess.StartTime.ToUniversalTime();
src\Servers\IIS\IIS\test\Common.FunctionalTests\LoggingTests.cs (4)
359var time = DateTime.Parse(prefixMatch.Groups[1].Value, CultureInfo.InvariantCulture).ToUniversalTime(); 366Assert.True(DateTime.UtcNow > time); 368Assert.True(DateTime.UtcNow.AddHours(-2) < time);
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (1)
1524var processStartTime = deploymentResult.HostProcess.StartTime.AddSeconds(-5);
InMemory.FunctionalTests (1)
src\Servers\Kestrel\shared\CorrelationIdGenerator.cs (1)
14private static long _lastId = DateTime.UtcNow.Ticks;
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))
InteropClient.cs (2)
536var deadline = DateTime.UtcNow.AddMilliseconds(1);
JwtClientSample (1)
Program.cs (1)
71await hubConnection.SendAsync("Broadcast", userId, $"Hello at {DateTime.Now}");
JwtSample (2)
Startup.cs (2)
35LifetimeValidator = (before, expires, token, parameters) => expires > DateTime.UtcNow, 81var token = new JwtSecurityToken("SignalRTestServer", "SignalRTests", claims, expires: DateTime.UtcNow.AddSeconds(30), signingCredentials: credentials);
Keycloak.ApiService (1)
Program.cs (1)
33DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
KeyManagementSimulator (2)
Program.cs (2)
88var startTime = DateTimeOffset.ParseExact("2015-03-01 00:00:00Z", "u", CultureInfo.InvariantCulture).UtcDateTime; 89var endTime = startTime.AddDays(dayCount);
LocalizationSample (6)
Startup.cs (6)
94await context.Response.WriteAsync($"<tr><th>{SR["Current date (invariant full):"]}</th><td>{DateTime.Now.ToString("F", CultureInfo.InvariantCulture)}</td></tr>"); 95await context.Response.WriteAsync($"<tr><th>{SR["Current date (invariant):"]}</th><td>{DateTime.Now.ToString(CultureInfo.InvariantCulture)}</td></tr>"); 96await context.Response.WriteAsync($"<tr><th>{SR["Current date (request full):"]}</th><td>{DateTime.Now.ToString("F", CultureInfo.CurrentCulture)}</td></tr>"); 97await context.Response.WriteAsync($"<tr><th>{SR["Current date (request):"]}</th><td>{DateTime.Now.ToString(CultureInfo.CurrentCulture)}</td></tr>"); 98await context.Response.WriteAsync($"<tr><th>{SR["Current time (invariant):"]}</th><td>{DateTime.Now.ToString("T", CultureInfo.InvariantCulture)}</td></tr>"); 99await context.Response.WriteAsync($"<tr><th>{SR["Current time (request):"]}</th><td>{DateTime.Now.ToString("T", CultureInfo.CurrentCulture)}</td></tr>");
Microsoft.Analyzers.Extra.Tests (1)
CallAnalysis\StaticTimeTests.cs (1)
20Assembly.GetAssembly(typeof(DateTime))!,
Microsoft.Analyzers.Local (7)
ApiLifecycle\Json\JsonValue.cs (7)
273public DateTime? AsDateTime => IsString && DateTime.TryParse((string?)_reference ?? string.Empty, out var value) 409public static implicit operator JsonValue(DateTime? value) 517public static explicit operator DateTime(JsonValue jsonValue) 519return jsonValue.AsDateTime ?? DateTime.MinValue; 526public static explicit operator DateTime?(JsonValue jsonValue)
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)
SystemClock.cs (1)
37var utcNowPrecisionSeconds = new DateTime((_timeProvider.GetUtcNow().Ticks / TimeSpan.TicksPerSecond) * TimeSpan.TicksPerSecond, DateTimeKind.Utc);
Microsoft.AspNetCore.Authentication.Certificate (1)
CertificateValidationCache.cs (1)
54var notAfter = certificate.NotAfter.ToUniversalTime();
Microsoft.AspNetCore.Authentication.JwtBearer (3)
JwtBearerHandler.cs (3)
263private static DateTime? GetSafeDateTime(DateTime dateTime) 267if (dateTime == DateTime.MinValue)
Microsoft.AspNetCore.Authentication.JwtBearer.Tools.Tests (2)
UserJwtsTests.cs (2)
339app.Run(new[] { "create", "--project", project, "--expires-on", DateTime.Now.AddDays(2).ToString("O") }); 368app.Run(new[] { "create", "--project", project, "--expires-on", DateTime.UtcNow.AddDays(2).ToString("O"), "--valid-for", "2h" });
Microsoft.AspNetCore.Authentication.OpenIdConnect (8)
OpenIdConnectHandler.cs (8)
1420var issued = validatedToken.ValidFrom; 1421if (issued != DateTime.MinValue) 1426var expires = validatedToken.ValidTo; 1427if (expires != DateTime.MinValue) 1475var issued = validatedToken.ValidFrom; 1476if (issued != DateTime.MinValue) 1481var expires = validatedToken.ValidTo; 1482if (expires != DateTime.MinValue)
Microsoft.AspNetCore.Authentication.Test (45)
JwtBearerTests.cs (12)
62expires: DateTime.Now.AddMinutes(30), 99expires: DateTime.Now.AddMinutes(30), 931notBefore: DateTime.Now.AddMinutes(-10), 932expires: DateTime.Now.AddMinutes(30), 976expires: DateTime.MaxValue, 1004var elementValue = DateTime.Parse(expiresElement.GetString(), CultureInfo.InvariantCulture); 1005var elementValueUtc = elementValue.ToUniversalTime(); 1008var max = DateTime.Parse(DateTime.MaxValue.ToString(CultureInfo.InvariantCulture), CultureInfo.InvariantCulture); 1288expires: DateTime.Now.AddMinutes(30),
JwtBearerTests_Handler.cs (12)
54expires: DateTime.Now.AddMinutes(30), 90expires: DateTime.Now.AddMinutes(30), 876notBefore: DateTime.Now.AddMinutes(-10), 877expires: DateTime.Now.AddMinutes(30), 920expires: DateTime.MaxValue, 947var elementValue = DateTime.Parse(expiresElement.GetString(), CultureInfo.InvariantCulture); 948var elementValueUtc = elementValue.ToUniversalTime(); 951var max = DateTime.Parse(DateTime.MaxValue.ToString(CultureInfo.InvariantCulture), CultureInfo.InvariantCulture); 1355expires: DateTime.Now.AddMinutes(30),
OpenIdConnect\OpenIdConnectChallengeTests.cs (2)
442Assert.True(nonceCookie.Expires > DateTime.UtcNow); 450Assert.True(nonceCookie.Expires > DateTime.UtcNow);
OpenIdConnect\OpenIdConnectTests.cs (17)
401DateTime utcNow = DateTime.UtcNow; 403Assert.Equal(DateTime.MaxValue, GetNonceExpirationTime(noncePrefix + DateTime.MaxValue.Ticks.ToString(CultureInfo.InvariantCulture) + nonceDelimiter, TimeSpan.FromHours(1))); 405Assert.Equal(DateTime.MinValue + TimeSpan.FromHours(1), GetNonceExpirationTime(noncePrefix + DateTime.MinValue.Ticks.ToString(CultureInfo.InvariantCulture) + nonceDelimiter, TimeSpan.FromHours(1))); 409Assert.Equal(DateTime.MinValue, GetNonceExpirationTime(noncePrefix, TimeSpan.FromHours(1))); 411Assert.Equal(DateTime.MinValue, GetNonceExpirationTime("", TimeSpan.FromHours(1))); 413Assert.Equal(DateTime.MinValue, GetNonceExpirationTime(noncePrefix + noncePrefix, TimeSpan.FromHours(1))); 417Assert.Equal(DateTime.MinValue, GetNonceExpirationTime(utcNow.Ticks.ToString(CultureInfo.InvariantCulture) + nonceDelimiter + utcNow.Ticks.ToString(CultureInfo.InvariantCulture) + nonceDelimiter, TimeSpan.FromHours(1))); 566private static DateTime GetNonceExpirationTime(string keyname, TimeSpan nonceLifetime) 568DateTime nonceTime = DateTime.MinValue; 581nonceTime = DateTime.FromBinary(Convert.ToInt64(timestamp, CultureInfo.InvariantCulture)); 582if ((nonceTime >= DateTime.UtcNow) && ((DateTime.MaxValue - nonceTime) < nonceLifetime)) 584nonceTime = DateTime.MaxValue;
TestSecurityToken.cs (2)
22public override DateTime ValidFrom => new DateTime(2008, 3, 22); 24public override DateTime ValidTo => new DateTime(2017, 3, 22);
Microsoft.AspNetCore.Authentication.WsFederation (4)
WsFederationHandler.cs (4)
320var issued = validatedToken.ValidFrom; 321if (issued != DateTime.MinValue) 325var expires = validatedToken.ValidTo; 326if (expires != DateTime.MinValue)
Microsoft.AspNetCore.Components (82)
BindConverter.cs (43)
326public static string FormatValue(DateTime value, CultureInfo? culture = null) => FormatDateTimeValueCore(value, format: null, culture); 338public static string FormatValue(DateTime value, [StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string format, CultureInfo? culture = null) => FormatDateTimeValueCore(value, format, culture); 340private static string FormatDateTimeValueCore(DateTime value, string? format, CultureInfo? culture) 350private static string FormatDateTimeValueCore(DateTime value, CultureInfo? culture) 364public static string? FormatValue(DateTime? value, CultureInfo? culture = null) => FormatNullableDateTimeValueCore(value, format: null, culture); 370/// <param name="format">The format to use. Provided to <see cref="DateTime.ToString(string, IFormatProvider)"/>.</param> 376public static string? FormatValue(DateTime? value, [StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string? format, CultureInfo? culture = null) => FormatNullableDateTimeValueCore(value, format, culture); 378private static string? FormatNullableDateTimeValueCore(DateTime? value, string? format, CultureInfo? culture) 393private static string? FormatNullableDateTimeValueCore(DateTime? value, CultureInfo? culture) 605return DateTime.MinValue.Add(value.ToTimeSpan()).ToString(format, culture ?? CultureInfo.CurrentCulture); 649return DateTime.MinValue.Add(value.Value.ToTimeSpan()).ToString(format, culture ?? CultureInfo.CurrentCulture); 1167/// Attempts to convert a value to a <see cref="System.DateTime"/>. 1173public static bool TryConvertToDateTime(object? obj, CultureInfo? culture, out DateTime value) 1179/// Attempts to convert a value to a <see cref="System.DateTime"/>. 1186public static bool TryConvertToDateTime(object? obj, CultureInfo? culture, [StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string format, out DateTime value) 1192/// Attempts to convert a value to a nullable <see cref="System.DateTime"/>. 1198public static bool TryConvertToNullableDateTime(object? obj, CultureInfo? culture, out DateTime? value) 1204/// Attempts to convert a value to a nullable <see cref="System.DateTime"/>. 1211public static bool TryConvertToNullableDateTime(object? obj, CultureInfo? culture, [StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string format, out DateTime? value) 1216internal static BindParser<DateTime> ConvertToDateTime = ConvertToDateTimeCore; 1217internal static BindParserWithFormat<DateTime> ConvertToDateTimeWithFormat = ConvertToDateTimeCore; 1218internal static BindParser<DateTime?> ConvertToNullableDateTime = ConvertToNullableDateTimeCore; 1219internal static BindParserWithFormat<DateTime?> ConvertToNullableDateTimeWithFormat = ConvertToNullableDateTimeCore; 1221private static bool ConvertToDateTimeCore(object? obj, CultureInfo? culture, out DateTime value) 1226private static bool ConvertToDateTimeCore(object? obj, CultureInfo? culture, string? format, out DateTime value) 1235if (format != null && DateTime.TryParseExact(text, format, culture ?? CultureInfo.CurrentCulture, DateTimeStyles.None, out var converted)) 1240else if (format == null && DateTime.TryParse(text, culture ?? CultureInfo.CurrentCulture, DateTimeStyles.None, out converted)) 1250private static bool ConvertToNullableDateTimeCore(object? obj, CultureInfo? culture, out DateTime? value) 1255private static bool ConvertToNullableDateTimeCore(object? obj, CultureInfo? culture, string? format, out DateTime? value) 1264if (format != null && DateTime.TryParseExact(text, format, culture ?? CultureInfo.CurrentCulture, DateTimeStyles.None, out var converted)) 1269else if (format == null && DateTime.TryParse(text, culture ?? CultureInfo.CurrentCulture, DateTimeStyles.None, out converted)) 1455if (ConvertToDateTimeCore(obj, culture, format, out var dateTime)) 1473if (ConvertToDateTimeCore(obj, culture, format, out var dateTime)) 1546if (ConvertToDateTimeCore(obj, culture, format, out var dateTime)) 1564if (ConvertToDateTimeCore(obj, culture, format, out var dateTime)) 1750else if (typeof(T) == typeof(DateTime)) 1752formatter = (BindFormatter<DateTime>)FormatDateTimeValueCore; 1754else if (typeof(T) == typeof(DateTime?)) 1756formatter = (BindFormatter<DateTime?>)FormatNullableDateTimeValueCore; 1941else if (typeof(T) == typeof(DateTime)) 1945else 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);
NavigationManagerExtensions.cs (6)
30[typeof(DateTime)] = value => Format((DateTime)value), 50private static string Format(DateTime value) 53private static string? Format(DateTime? value) 302public static string GetUriWithQueryParameter(this NavigationManager navigationManager, string name, DateTime value) 316public static string GetUriWithQueryParameter(this NavigationManager navigationManager, string name, DateTime? value)
Routing\RouteTable.cs (1)
114routeValues[parameter.Name] = DateTime.Parse((string)parameterValue!, CultureInfo.InvariantCulture);
Routing\UrlValueConstraint.cs (6)
41private static bool TryParse(ReadOnlySpan<char> str, out DateTime result) 42=> DateTime.TryParse(str, CultureInfo.InvariantCulture, DateTimeStyles.None, out result); 70var x when x == typeof(DateTime) => new TypedUrlValueConstraint<DateTime>(TryParse), 71var x when x == typeof(DateTime?) => new NullableTypedUrlValueConstraint<DateTime>(TryParse),
src\Http\Routing\src\Constraints\DateTimeRouteConstraint.cs (2)
47if (value is DateTime) 61return DateTime.TryParse(valueString, CultureInfo.InvariantCulture, DateTimeStyles.None, out _);
Microsoft.AspNetCore.Components.Endpoints (6)
FormMapping\WellKnownConverters.cs (6)
41{ typeof(DateTime), new ParsableConverter<DateTime>() }, 73converters.Add(typeof(DateTime?), new NullableConverter<DateTime>((FormDataConverter<DateTime>)converters[typeof(DateTime)]));
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) },
Builder\TestFileProvider\TestFileProvider.cs (1)
46LastModified = DateTime.UtcNow,
Microsoft.AspNetCore.Components.Forms.Tests (1)
FieldIdentifierTest.cs (1)
22var ex = Assert.Throws<ArgumentException>(() => new FieldIdentifier(DateTime.Now, "somefield"));
Microsoft.AspNetCore.Components.Server (9)
src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\Internal\DateTimeConstants.cs (1)
12internal static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\MessagePackReader.cs (4)
609/// Reads a <see cref="DateTime"/> from a value encoded with 616public DateTime ReadDateTime() => this.ReadDateTime(this.ReadExtensionFormatHeader()); 619/// Reads a <see cref="DateTime"/> from a value encoded with 627public DateTime ReadDateTime(ExtensionHeader header)
src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\MessagePackWriter.cs (4)
617/// Writes a <see cref="DateTime"/> using the message code <see cref="ReservedMessagePackExtensionTypeCode.DateTime"/>. 620/// <exception cref="NotSupportedException">Thrown when <see cref="OldSpec"/> is true because the old spec does not define a <see cref="DateTime"/> format.</exception> 621public void Write(DateTime dateTime) 625throw new NotSupportedException($"The MsgPack spec does not define a format for {nameof(DateTime)} in {nameof(this.OldSpec)} mode. Turn off {nameof(this.OldSpec)} mode or use NativeDateTimeFormatter.");
Microsoft.AspNetCore.Components.Tests (54)
BindConverterTest.cs (8)
161var value = DateTime.Now; 175var value = DateTime.Now; 189var value = DateOnly.FromDateTime(DateTime.Now); 203var value = DateOnly.FromDateTime(DateTime.Now); 217var value = TimeOnly.FromDateTime(DateTime.Now); 231var value = TimeOnly.FromDateTime(DateTime.Now);
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);
ParameterViewTest.cs (4)
197var result = parameters.GetValueOrDefault<DateTime>("nonexisting entry"); 207var explicitDefaultValue = new DateTime(2018, 3, 20); 215var result = parameters.GetValueOrDefault("nonexisting entry", explicitDefaultValue);
RendererTest.cs (1)
675OnArbitraryDelegateEvent = (Action<DateTime>)(arg => { }),
RenderTreeDiffBuilderTest.cs (2)
1738var dateTimeWillNotChange = DateTime.Now;
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)
Forms\InputDate.cs (3)
15/// <item><description><see cref="DateTime"/></description></item> 57if (type != typeof(DateTime) && 102DateTime dateTimeValue => BindConverter.FormatValue(dateTimeValue, _format, CultureInfo.InvariantCulture),
Microsoft.AspNetCore.Components.Web.Tests (17)
Forms\InputBaseTest.cs (13)
263var rootComponent = new TestInputHostComponent<DateTime, TestDateInputComponent> 280var valueChangedArgs = new List<DateTime>(); 281var rootComponent = new TestInputHostComponent<DateTime, TestDateInputComponent> 296var receivedParsedValue = valueChangedArgs.Single(); 310var valueChangedArgs = new List<DateTime>(); 311var rootComponent = new TestInputHostComponent<DateTime, TestDateInputComponent> 331var receivedParsedValue = valueChangedArgs.Single(); 345var rootComponent = new TestInputHostComponent<DateTime, TestDateInputComponent> 534public DateTime DateProperty { get; set; } 575private class TestDateInputComponent : TestInputComponent<DateTime> 577protected override string FormatValueAsString(DateTime value) 580protected override bool TryParseValueFromString(string value, out DateTime result, out string validationErrorMessage) 582if (DateTime.TryParse(value, out result))
Forms\InputDateTest.cs (4)
13var rootComponent = new TestInputHostComponent<DateTime, TestInputDateComponent> 39var rootComponent = new TestInputHostComponent<DateTime, TestInputDateComponent> 54public DateTime DateProperty { get; set; } 57private class TestInputDateComponent : InputDate<DateTime>
Microsoft.AspNetCore.Connections.Abstractions (1)
src\Shared\ParameterDefaultValue\ParameterDefaultValue.cs (1)
66catch (FormatException) when (parameter.ParameterType == typeof(DateTime))
Microsoft.AspNetCore.DataProtection (12)
KeyManagement\Internal\CacheableKeyRing.cs (2)
30internal DateTime ExpirationTimeUtc { get; } 34internal static bool IsValid([NotNullWhen(true)] CacheableKeyRing? keyRing, DateTime utcNow)
KeyManagement\KeyRingProvider.cs (10)
59AutoRefreshWindowEnd = DateTime.UtcNow.AddMinutes(2); 77internal DateTime AutoRefreshWindowEnd { get; set; } 79internal bool InAutoRefreshWindow() => DateTime.UtcNow < AutoRefreshWindowEnd; 205return GetCurrentKeyRingCore(DateTime.UtcNow); 210return GetCurrentKeyRingCore(DateTime.UtcNow, forceRefresh: true); 213internal IKeyRing GetCurrentKeyRingCore(DateTime utcNow, bool forceRefresh = false) 225private IKeyRing GetCurrentKeyRingCoreOld(DateTime utcNow, bool forceRefresh) 325private IKeyRing GetCurrentKeyRingCoreNew(DateTime utcNow, bool forceRefresh) 367utcNowState => CacheableKeyRingProvider.GetCacheableKeyRing((DateTime)utcNowState!), 444private IKeyRing? GetKeyRingFromCompletedTaskUnsynchronized(Task<CacheableKeyRing> task, DateTime utcNow)
Microsoft.AspNetCore.DataProtection.Extensions.Tests (4)
DataProtectionAdvancedExtensionsTests.cs (2)
21var expiration = StringToDateTime("2015-01-01 00:00:00Z"); 96private static DateTime StringToDateTime(string input)
TimeLimitedDataProtectorTests.cs (2)
157var expectedExpiration = StringToDateTime("2020-01-01 00:00:00Z"); 174private static DateTime StringToDateTime(string input)
Microsoft.AspNetCore.DataProtection.Tests (21)
KeyManagement\CacheableKeyRingTests.cs (1)
14Assert.False(CacheableKeyRing.IsValid(null, DateTime.UtcNow));
KeyManagement\KeyRingBasedDataProtectorTests.cs (2)
225private static DateTime StringToDateTime(string input) 301keyRingProvider.AutoRefreshWindowEnd = DateTime.UtcNow;
KeyManagement\KeyRingProviderTests.cs (18)
24var now = StringToDateTime("2015-03-01 00:00:00Z"); 62var now = StringToDateTime("2016-02-29 20:00:00Z"); 106var now = StringToDateTime("2015-03-01 00:00:00Z"); 197var now = StringToDateTime("2015-03-01 00:00:00Z"); 243var now = StringToDateTime("2015-03-01 00:00:00Z"); 279var now = StringToDateTime("2016-02-01 00:00:00Z"); 328var now = StringToDateTime("2016-02-01 00:00:00Z"); 366var now = StringToDateTime("2016-02-01 00:00:00Z"); 576var now = StringToDateTime("2015-03-01 00:00:00Z"); 602var now = StringToDateTime("2015-03-01 00:00:00Z"); 643var now = StringToDateTime("2015-03-01 00:00:00Z"); 676var now = StringToDateTime("2015-03-01 00:00:00Z"); 730var originalKeyRingTime = StringToDateTime("2015-03-01 00:00:00Z"); 733var throwKeyRingTime = StringToDateTime("2015-03-01 12:00:00Z"); 736var updatedKeyRingTime = StringToDateTime("2015-03-01 12:02:00Z"); 813var time1 = StringToDateTime("2015-03-01 00:00:00Z"); 814var time2 = time1.AddHours(1); 915private static DateTime StringToDateTime(string input)
Microsoft.AspNetCore.Diagnostics.Tests (4)
ExceptionHandlerTest.cs (4)
201var expiresTime = DateTime.UtcNow.AddDays(5).ToString("R"); 257var expiresTime = DateTime.UtcNow.AddDays(10).ToString("R"); 352httpContext.Response.Headers.Add("Expires", new[] { DateTime.UtcNow.AddDays(10).ToString("R") }); 382var expiresTime = DateTime.UtcNow.AddDays(10).ToString("R");
Microsoft.AspNetCore.Grpc.JsonTranscoding (6)
Internal\JsonTranscodingServerCallContext.cs (2)
137protected override DateTime DeadlineCore => DateTime.MaxValue;
src\Grpc\JsonTranscoding\src\Shared\Legacy.cs (4)
52private static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); 75DateTime parsed = DateTime.ParseExact( 145DateTime dateTime = UnixEpoch.AddSeconds(seconds);
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (40)
artifacts\obj\Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests\Release\net10.0\Proto\HttpbodyGrpc.cs (2)
111public virtual global::Google.Api.HttpBody HelloWorld(global::Transcoding.HelloWorldRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) 121public virtual grpc::AsyncUnaryCall<global::Google.Api.HttpBody> HelloWorldAsync(global::Transcoding.HelloWorldRequest 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.JsonTranscoding.Tests\Release\net10.0\Proto\Issue045270\HelloGrpc.cs (2)
107public virtual global::Example.Hello.SayResponse Say(global::Example.Hello.SayRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) 117public virtual grpc::AsyncUnaryCall<global::Example.Hello.SayResponse> SayAsync(global::Example.Hello.SayRequest 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.JsonTranscoding.Tests\Release\net10.0\Proto\Issue048192\HelloGrpc.cs (2)
107public virtual global::Custom.Http.Rule.SayResponse Say(global::Custom.Http.Rule.SayRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) 117public virtual grpc::AsyncUnaryCall<global::Custom.Http.Rule.SayResponse> SayAsync(global::Custom.Http.Rule.SayRequest 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.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)
artifacts\obj\Microsoft.AspNetCore.Grpc.Microbenchmarks\Release\net10.0\Proto\GreetGrpc.cs (3)
118public virtual global::Greet.HelloReply SayHello(global::Greet.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) 142public virtual grpc::AsyncUnaryCall<global::Greet.HelloReply> SayHelloAsync(global::Greet.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) 158public virtual grpc::AsyncServerStreamingCall<global::Greet.HelloReply> SayHellos(global::Greet.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
Microsoft.AspNetCore.Grpc.Swagger (4)
src\Grpc\JsonTranscoding\src\Shared\Legacy.cs (4)
52private static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); 75DateTime parsed = DateTime.ParseExact( 145DateTime dateTime = UnixEpoch.AddSeconds(seconds);
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\CounterGrpc.cs (2)
111public virtual global::Count.CountReply Add(global::Count.CountRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) 121public virtual grpc::AsyncUnaryCall<global::Count.CountReply> AddAsync(global::Count.CountRequest 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\GreeterGrpc.cs (2)
128public virtual global::Greet.HelloReply SayHello(global::Greet.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) 152public virtual grpc::AsyncUnaryCall<global::Greet.HelloReply> SayHelloAsync(global::Greet.HelloRequest 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)
Internal\HostingApplicationDiagnostics.cs (1)
477activity.SetEndTime(DateTime.UtcNow);
Microsoft.AspNetCore.Http (1)
Features\HttpRequestIdentifierFeature.cs (1)
16private static long _requestId = DateTime.UtcNow.Ticks;
Microsoft.AspNetCore.Http.Abstractions (1)
Validation\RuntimeValidatableParameterInfoResolver.cs (1)
81type == typeof(DateTime) ||
Microsoft.AspNetCore.Http.Abstractions.Tests (6)
Validation\RuntimeValidatableParameterInfoResolverTests.cs (1)
39[InlineData(typeof(DateTime))]
Validation\ValidatableTypeInfoTests.cs (5)
421CreatePropertyInfo(typeof(IntermediateEntity), typeof(DateTime), "CreatedAt", "CreatedAt", [new PastDateAttribute()]) 443CreatedAt = DateTime.Now.AddDays(1) // Invalid: future date 678public DateTime CreatedAt { get; set; } 690if (value is DateTime date && date > DateTime.Now)
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)
src\Components\Endpoints\src\FormMapping\WellKnownConverters.cs (6)
41{ typeof(DateTime), new ParsableConverter<DateTime>() }, 73converters.Add(typeof(DateTime?), new NullableConverter<DateTime>((FormDataConverter<DateTime>)converters[typeof(DateTime)]));
src\Shared\ParameterBindingMethodCache.cs (5)
149Type t when t == typeof(DateTime) => DateTimeStyles.AdjustToUniversal | DateTimeStyles.AllowWhiteSpaces, 536if (type == typeof(DateTime)) 538methodInfo = typeof(DateTime).GetMethod( 539nameof(DateTime.TryParse), 541new[] { typeof(string), typeof(IFormatProvider), typeof(DateTimeStyles), typeof(DateTime).MakeByRefType() });
Microsoft.AspNetCore.Http.Extensions.Tests (11)
ParameterBindingMethodCacheTests.cs (1)
62[InlineData(typeof(DateTime))]
RequestDelegateFactoryTests.cs (6)
305var now = DateTime.Now; 326new object[] { (Action<HttpContext, DateTime[]>)Store, new[] { now.ToString("o") },new[] { now.ToUniversalTime() } }, 357var now = DateTime.Now; 377new object[] { (Action<HttpContext, DateTime>)Store, now.ToString("o"), now.ToUniversalTime() },
RequestDelegateGenerator\RequestDelegateCreationTests.Arrays.cs (2)
110var now = DateTime.Now;
RequestDelegateGenerator\RequestDelegateCreationTests.TryParse.cs (2)
20var now = DateTime.Now;
Microsoft.AspNetCore.Http.Microbenchmarks (3)
ValidatableTypesBenchmark.cs (3)
67CreatedOn = DateTime.UtcNow 196public DateTime CreatedOn { get; set; } 299CreatePropertyInfo(typeof(ComplexModel), "CreatedOn", typeof(DateTime))
Microsoft.AspNetCore.Http.Tests (1)
CookieOptionsTests.cs (1)
21Expires = DateTime.UtcNow,
Microsoft.AspNetCore.HttpLogging (10)
FileLoggerProcessor.cs (4)
24private DateTime _today; 158DateTime today = SystemDateTime.Now; 302private int GetFirstFileCount(DateTime date) 319private string GetFullName(DateTime date)
ISystemDateTime.cs (1)
11DateTime Now { get; }
SystemDateTime.cs (2)
8public DateTime Now => DateTime.Now;
W3CLoggerProcessor.cs (1)
29await WriteMessageAsync("#Start-Date: " + DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture), streamWriter, cancellationToken);
W3CLoggingMiddleware.cs (2)
80var now = DateTime.UtcNow;
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)
MockSystemDateTime.cs (1)
8public DateTime Now { get; set; }
W3CLoggerTests.cs (9)
11readonly DateTime _timestampOne = new DateTime(2021, 01, 02, 03, 04, 05); 18var now = DateTime.UtcNow; 40var startDate = DateTime.Parse(lines[1].Substring(13), CultureInfo.InvariantCulture); 62var now = DateTime.UtcNow; 85var startDate = DateTime.Parse(lines[1].Substring(13), CultureInfo.InvariantCulture);
W3CLoggingMiddlewareTests.cs (20)
86var now = DateTime.UtcNow; 94var startDate = DateTime.Parse(lines[1].Substring(13), CultureInfo.InvariantCulture); 131var now = DateTime.UtcNow; 139var startDate = DateTime.Parse(lines[1].Substring(13), CultureInfo.InvariantCulture); 172var now = DateTime.UtcNow; 204var now = DateTime.UtcNow; 251var now = DateTime.UtcNow; 259var startDate = DateTime.Parse(lines[1].Substring(13), CultureInfo.InvariantCulture); 289var now = DateTime.UtcNow; 297var startDate = DateTime.Parse(lines[1].Substring(13), CultureInfo.InvariantCulture);
Microsoft.AspNetCore.Identity (1)
TimeProviderClock.cs (1)
29var utcNowPrecisionSeconds = new DateTime((_timeProvider.GetUtcNow().Ticks / TimeSpan.TicksPerSecond) * TimeSpan.TicksPerSecond, DateTimeKind.Utc);
Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test (2)
UserStoreWithGenericsTest.cs (2)
214Created = DateTime.UtcNow 298public DateTime Created { get; set; }
Microsoft.AspNetCore.Identity.Specification.Tests (1)
UserManagerSpecificationTests.cs (1)
1336var lockoutEnd = new DateTimeOffset(DateTime.Now.AddMinutes(30).ToLocalTime());
Microsoft.AspNetCore.Mvc.Abstractions (5)
src\Shared\ParameterBindingMethodCache.cs (5)
149Type t when t == typeof(DateTime) => DateTimeStyles.AdjustToUniversal | DateTimeStyles.AllowWhiteSpaces, 536if (type == typeof(DateTime)) 538methodInfo = typeof(DateTime).GetMethod( 539nameof(DateTime.TryParse), 541new[] { typeof(string), typeof(IFormatProvider), typeof(DateTimeStyles), typeof(DateTime).MakeByRefType() });
Microsoft.AspNetCore.Mvc.Abstractions.Test (2)
ModelBinding\ModelMetadataTest.cs (2)
418var metadata = new TestModelMetadata(typeof(DateTime)); 435var metadata = new TestModelMetadata(typeof(DateTime));
Microsoft.AspNetCore.Mvc.ApiExplorer (1)
EndpointModelMetadata.cs (1)
61|| underlyingType == typeof(DateTime)
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (4)
EndpointMetadataApiDescriptionProviderTest.cs (4)
583AssertPathParameter(GetApiDescription((DateTime foo) => { }, "/{foo}"), typeof(DateTime)); 604AssertPathParameter(GetApiDescription((DateTime? foo) => { }, "/{foo}"), typeof(DateTime?));
Microsoft.AspNetCore.Mvc.Core (7)
ModelBinding\Binders\DateTimeModelBinder.cs (4)
12/// An <see cref="IModelBinder"/> for <see cref="DateTime"/> and nullable <see cref="DateTime"/> models. 65else if (type == typeof(DateTime)) 67model = DateTime.Parse(value, valueProviderResult.Culture, _supportedStyles);
ModelBinding\Binders\DateTimeModelBinderProvider.cs (3)
13/// An <see cref="IModelBinderProvider"/> for binding <see cref="DateTime" /> and nullable <see cref="DateTime"/> models. 25if (modelType == typeof(DateTime))
Microsoft.AspNetCore.Mvc.Core.Test (56)
ApiExplorer\ApiConventionMatcherTest.cs (1)
264[InlineData(typeof(string), typeof(DateTime))]
Formatters\JsonInputFormatterTestBase.cs (4)
214var expected = new DateTime(2012, 02, 01, 00, 45, 00); 221var formatterContext = CreateInputFormatterContext(typeof(DateTime), httpContext); 228var dateValue = Assert.IsType<DateTime>(result.Model);
Formatters\SystemTextJsonInputFormatterTest.cs (5)
215public DateTime DateValue { get; set; } 234private class DateTimeConverter : JsonConverter<DateTime> 236public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 238return DateTime.Parse(reader.GetString(), CultureInfo.InvariantCulture); 241public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options)
Infrastructure\ParameterDefaultValuesTest.cs (3)
38new object[] { default(Guid), default(TimeSpan), default(DateTime), default(DateTimeOffset) }, 77DateTime dateTime = default(DateTime),
ModelBinding\Binders\ArrayModelBinderProviderTest.cs (1)
31[InlineData(typeof(DateTime?[]))]
ModelBinding\Binders\ComplexObjectModelBinderTest.cs (8)
832var dob = new DateTime(2001, 1, 1); 1173private DateTime? _dateOfDeath; 1176public DateTime DateOfBirth { get; set; } 1178public DateTime? DateOfDeath 1216public DateTime DateOfBirth { get; set; } 1219public DateTime? DateOfDeath { get; set; } 1233public DateTime DateOfBirth { get; set; } 1236public DateTime? DateOfDeath { get; set; }
ModelBinding\Binders\ComplexTypeModelBinderTest.cs (8)
964var dob = new DateTime(2001, 1, 1); 1348private DateTime? _dateOfDeath; 1351public DateTime DateOfBirth { get; set; } 1353public DateTime? DateOfDeath 1391public DateTime DateOfBirth { get; set; } 1394public DateTime? DateOfDeath { get; set; } 1408public DateTime DateOfBirth { get; set; } 1411public DateTime? DateOfDeath { get; set; }
ModelBinding\Binders\DateTimeModelBinderProviderTest.cs (2)
31var context = new TestModelBinderProviderContext(typeof(DateTime)); 44var context = new TestModelBinderProviderContext(typeof(DateTime?));
ModelBinding\Binders\DateTimeModelBinderTest.cs (13)
80var bindingContext = GetBindingContext(typeof(DateTime)); 95var bindingContext = GetBindingContext(typeof(DateTime?)); 138var bindingContext = GetBindingContext(typeof(DateTime?)); 155[InlineData(typeof(DateTime))] 156[InlineData(typeof(DateTime?))] 160var expected = new DateTime(2019, 06, 14, 2, 30, 4, 0, DateTimeKind.Utc); 173var model = Assert.IsType<DateTime>(bindingContext.Result.Model); 184var expected = DateTime.Parse("2019-06-14T02:30:04.0000000Z", CultureInfo.InvariantCulture); 196var model = Assert.IsType<DateTime>(bindingContext.Result.Model); 209modelType ??= typeof(DateTime);
ModelBinding\Binders\FloatingPointTypeModelBinderProviderTest.cs (2)
33[InlineData(typeof(DateTime))] 34[InlineData(typeof(DateTime?))]
ModelBinding\Binders\HeaderModelBinderProviderTest.cs (2)
49[InlineData(typeof(DateTime))] 72[InlineData(typeof(DateTime?))]
ModelBinding\Binders\SimpleTypeModelBinderProviderTest.cs (2)
31[InlineData(typeof(DateTime))] 32[InlineData(typeof(DateTime?))]
ModelBinding\Metadata\DefaultModelMetadataTest.cs (2)
346[InlineData(typeof(DateTime))] 347[InlineData(typeof(DateTime?))]
ModelBinding\ModelBindingHelperTest.cs (1)
1238[InlineData(typeof(DateTime))]
ModelBinding\Validation\DefaultObjectValidatorTests.cs (2)
878new List<DateTime> 884typeof(ICollection<DateTime>)
Microsoft.AspNetCore.Mvc.DataAnnotations.Test (1)
DataTypeClientModelValidatorProviderTest.cs (1)
67[InlineData(typeof(DateTime))]
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (12)
XmlDataContractSerializerInputFormatterTest.cs (1)
39public DateTime SampleDate { get; set; }
XmlSerializerInputFormatterTest.cs (11)
27public DateTime SampleDate { get; set; } 42var expectedDateTime = XmlConvert.ToString(DateTime.UtcNow, XmlDateTimeSerializationMode.Utc); 79var expectedDateTime = XmlConvert.ToString(DateTime.UtcNow, XmlDateTimeSerializationMode.Utc); 116var expectedDateTime = XmlConvert.ToString(DateTime.UtcNow, XmlDateTimeSerializationMode.Utc); 152var expectedDateTime = XmlConvert.ToString(DateTime.UtcNow, XmlDateTimeSerializationMode.Utc); 191var expectedDateTime = XmlConvert.ToString(DateTime.UtcNow, XmlDateTimeSerializationMode.Utc); 336var expectedDateTime = XmlConvert.ToString(DateTime.UtcNow, XmlDateTimeSerializationMode.Utc); 368var expectedDateTime = XmlConvert.ToString(DateTime.UtcNow, XmlDateTimeSerializationMode.Utc); 430"<SampleDate>" + XmlConvert.ToString(DateTime.UtcNow, XmlDateTimeSerializationMode.Utc) 451"<SampleDate>" + XmlConvert.ToString(DateTime.UtcNow, XmlDateTimeSerializationMode.Utc) 586var expectedDateTime = XmlConvert.ToString(DateTime.UtcNow, XmlDateTimeSerializationMode.Utc);
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));
RazorPagesTest.cs (1)
1407expected = $"id: 10, guid: {default(Guid)}, boolean: {default(bool)}, dateTime: {default(DateTime)}";
Microsoft.AspNetCore.Mvc.IntegrationTests (8)
Models\Software.cs (1)
13public DateTime DatePurchased { get; set; }
Models\SoftwareViewModel.cs (1)
14public DateTime DatePurchased { get; set; }
SimpleTypeModelBinderIntegrationTest.cs (6)
240ParameterType = typeof(DateTime), 260var model = Assert.IsType<DateTime>(modelBindingResult.Model); 285ParameterType = typeof(DateTime), 309var model = Assert.IsType<DateTime>(modelBindingResult.Model);
Microsoft.AspNetCore.Mvc.NewtonsoftJson (2)
BsonTempDataSerializer.cs (2)
38{ JTokenType.Date, typeof(DateTime) }, 243type.Equals(typeof(DateTime)) ||
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (15)
BsonTempDataSerializerTest.cs (6)
116var value = new DateTime(2007, 1, 1); 128var roundTripValue = Assert.IsType<DateTime>(values[key]); 231var dateTime = new DateTime(2007, 1, 1); 233var value = new List<DateTime> 249var roundTripValue = Assert.IsType<DateTime[]>(values[key]);
NewtonsoftJsonInputFormatterTest.cs (1)
652public DateTime DateValue { get; set; }
src\Mvc\Mvc.Core\test\Formatters\JsonInputFormatterTestBase.cs (4)
214var expected = new DateTime(2012, 02, 01, 00, 45, 00); 221var formatterContext = CreateInputFormatterContext(typeof(DateTime), httpContext); 228var dateValue = Assert.IsType<DateTime>(result.Model);
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)
ApplicationModels\TempDataFilterPageApplicationModelProviderTest.cs (2)
146public DateTime? DateTime { get; set; } 152public DateTime? DateTime { get; set; }
ApplicationModels\ViewDataAttributePageApplicationModelProviderTest.cs (2)
66public DateTime? DateTime { get; set; } 72public DateTime? DateTime { get; set; }
Microsoft.AspNetCore.Mvc.TagHelpers (2)
InputTagHelper.cs (2)
406(modelExplorer.Model is DateTime || modelExplorer.Model is DateTimeOffset)) 490(typeof(DateTime) == modelExplorer.Metadata.UnderlyingOrModelType ||
Microsoft.AspNetCore.Mvc.TagHelpers.Test (9)
InputTagHelperTest.cs (8)
2088var model = new DateTime( 2219var model = new DateTime( 2343var model = new DateTime( 2439public DateTime Date { get; set; } 2441public DateTime DateTime { get; set; } 2451public DateTime? NullableDate { get; set; } 2453public DateTime? NullableDateTime { get; set; } 2463public DateTime DateTimeLocal { get; set; }
LinkTagHelperTest.cs (1)
1242public DateTime ToDateTime(IFormatProvider provider)
Microsoft.AspNetCore.Mvc.ViewFeatures (5)
DefaultEditorTemplates.cs (1)
428if (value is DateTime || value is DateTimeOffset)
FormatWeekHelper.cs (1)
19if (value is DateTime date)
Infrastructure\DefaultTempDataSerializer.cs (3)
48else if (item.Value.TryGetDateTime(out var dateTime)) 174case DateTime dateTime: 228type == typeof(DateTime) ||
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; }
DefaultEditorTemplatesTest.cs (4)
1042var model = new DateTime( 1060provider.ForType<DateTime>().DisplayDetails(dd => 1111var model = new DateTime( 1129provider.ForType<DateTime>().DisplayDetails(dd =>
Filters\TempDataApplicationModelProviderTest.cs (1)
125public DateTime? DateTime { get; set; }
Filters\ViewDataAttributeApplicationModelProviderTest.cs (2)
78public DateTime? DateTime { get; set; } 84public DateTime? DateTime { get; set; }
Filters\ViewDataAttributePropertyProviderTest.cs (1)
77public DateTime? DateTime { get; set; }
FormatWeekHelperTest.cs (2)
24var key = ModelMetadataIdentity.ForType(typeof(DateTime)); 32var model = new DateTime(year, month, day);
Infrastructure\DefaultTempDataSerializerTest.cs (1)
19var value = new DateTime(2009, 1, 1, 12, 37, 43);
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);
MemberExpressionCacheKeyComparerTest.cs (2)
202public DateTime DateTime { get; set; } 204public DateTime? NullableDateTime { get; set; }
MemberExpressionCacheKeyTest.cs (8)
37typeof(DateTime).GetProperty(nameof(DateTime.Ticks)), 38typeof(DateTime?).GetProperty(nameof(Nullable<DateTime>.Value)), 57typeof(DateTime).GetProperty(nameof(DateTime.Ticks)), 91public DateTime DateTime { get; set; } 93public DateTime? NullableDateTime { get; set; }
TemplateRendererTest.cs (1)
20{ typeof(DateTime), new string[] { "DateTime", "String" } },
ViewDataOfTTest.cs (1)
30Exception ex = Assert.Throws<InvalidOperationException>(() => viewData.Model = DateTime.UtcNow);
Microsoft.AspNetCore.Mvc.Views.TestCommon (1)
TestFileProvider.cs (1)
46LastModified = DateTime.UtcNow,
Microsoft.AspNetCore.OpenApi (8)
Extensions\JsonNodeSchemaExtensions.cs (1)
42[typeof(DateTime)] = new() { Type = JsonSchemaType.String, Format = "date-time" },
Extensions\JsonTypeInfoExtensions.cs (1)
27[typeof(DateTime)] = "DateTime",
Services\OpenApiConstants.cs (1)
57typeof(DateTime),
src\Shared\ParameterBindingMethodCache.cs (5)
149Type t when t == typeof(DateTime) => DateTimeStyles.AdjustToUniversal | DateTimeStyles.AllowWhiteSpaces, 536if (type == typeof(DateTime)) 538methodInfo = typeof(DateTime).GetMethod( 539nameof(DateTime.TryParse), 541new[] { typeof(string), typeof(IFormatProvider), typeof(DateTimeStyles), typeof(DateTime).MakeByRefType() });
Microsoft.AspNetCore.OpenApi.Microbenchmarks (1)
GenerationBenchmarks.cs (1)
34_builder.MapGet($"/{i}", (int i) => new Todo(1, "Write benchmarks", false, DateTime.Now));
Microsoft.AspNetCore.OpenApi.SourceGenerators.Tests (2)
AdditionalTextsTests.Schemas.cs (1)
239Assert.Equal(new DateTime(2022, 01, 01), dateTimeTypeExample.GetValue<DateTime>());
SchemaTests.cs (1)
231Assert.Equal(new DateTime(2022, 01, 01), dateTimeTypeExample.GetValue<DateTime>());
Microsoft.AspNetCore.OpenApi.Tests (76)
Services\CreateSchemaReferenceIdTests.cs (2)
166builder.MapPost("/", (Todo todo) => new TodoWithDueDate(todo.Id, todo.Title, todo.Completed, todo.CreatedAt, DateTime.UtcNow)); 209builder.MapPost("/", (Todo todo) => new TodoWithDueDate(todo.Id, todo.Title, todo.Completed, todo.CreatedAt, DateTime.UtcNow));
Services\OpenApiDocumentService\OpenApiDocumentServiceTests.RequestBody.cs (2)
463builder.MapPost("/form", ([FromForm] int id, [FromForm] DateTime date, [FromForm] short? value) => { }); 893private void ActionWithDateTimeForm([FromForm] DateTime model) { }
Services\OpenApiDocumentService\OpenApiDocumentServiceTests.Responses.cs (3)
195builder.MapGet("/api/todos", [Produces("application/json", "application/xml")] () => new Todo(1, "Test todo", false, DateTime.Now)); 359{ 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. 390{ 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 (8)
343[([Range(typeof(DateTime), "2024-02-01", "2024-02-031")] DateTime id) => {}, (OpenApiSchema schema) => { Assert.Null(schema.Minimum); Assert.Null(schema.Maximum); }], 379[([Range(typeof(DateTime), "2024-02-01", "2024-02-031")] DateTime id) => {}, (OpenApiSchema schema) => { Assert.Null(schema.Minimum); Assert.Null(schema.Maximum); }], 404[([Range(typeof(DateTime), "2024-02-01", "2024-02-031")] DateTime id) => {}, (OpenApiSchema schema) => { Assert.Null(schema.Minimum); Assert.Null(schema.Maximum); }], 442builder.MapGet("/api-4", ([Required][FromHeader] DateTime date) => { }); 526public DateTime Date { get; set; }
Services\OpenApiSchemaService\OpenApiSchemaService.RequestBodySchemas.cs (2)
558public DateTime CreatedAt { get; set; } 567public DateTime? NullableDateTime { get; set; }
Services\OpenApiSchemaService\OpenApiSchemaService.ResponseSchemas.cs (13)
63builder.MapGet("/api", () => new Todo(1, "Test Title", true, DateTime.Now)); 175static Todo? GetTodo() => Random.Shared.Next() < 0.5 ? new Todo(1, "Test Title", true, DateTime.Now) : null; 243builder.MapGet("/api", () => new TodoWithDueDate(1, "Test Title", true, DateTime.Now, DateTime.Now.AddDays(1))); 297builder.MapGet("/api", () => new Result<Todo>(true, new TodoWithDueDate(1, "Test Title", true, DateTime.Now, DateTime.Now.AddDays(1)), null)); 405builder.MapGet("/api", () => TypedResults.Created("/test/1", new { Id = 1, Name = "Test", Todo = new Todo(1, "Test", true, DateTime.Now) })); 467builder.MapGet("/", () => TypedResults.Ok<List<Todo>>([new Todo(1, "Test Title", true, DateTime.Now), new Todo(2, "Test Title 2", false, DateTime.Now)])); 514builder.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)]))); 654builder.MapGet("/", () => new ClassWithObjectProperty { Object = new Todo(1, "Test Title", true, DateTime.Now) }); 726internal 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\CustomSchemaTransformerTests.cs (2)
87builder.MapGet("/api", () => TypedResults.Ok(new Todo(1, "Task", false, DateTime.Now))); 533public DateTime CreatedAt { get; set; }
Transformers\DocumentTransformerTests.cs (3)
169builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 197builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 224builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
Transformers\Implementations\OpenApiSchemaReferenceTransformerTests.cs (1)
282builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
Transformers\OperationTransformerTests.cs (4)
407builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 434builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 461builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 462builder.MapGet("/todo-2", () => new Todo(1, "Item1", false, DateTime.Now));
Transformers\SchemaTransformerTests.cs (20)
67Assert.Equal(typeof(DateTime), context.JsonTypeInfo.Type); 77builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 100Assert.Equal(typeof(DateTime), context.JsonTypeInfo.Type); 114builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 132builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 185builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 216builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 246builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 269builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 293builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 331builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 368builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 394builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 530builder.MapGet("/list-of-todo", () => new List<Todo> { new Todo(1, "Item1", false, DateTime.Now) }); 726builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 784builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 811builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 838builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 864builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 903builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
Transformers\TypeBasedTransformerLifetimeTests.cs (13)
18builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 40builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 66builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 92builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 117builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 139builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 164builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 190builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 215builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 236builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 259builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 285builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 311builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
Microsoft.AspNetCore.OutputCaching.StackExchangeRedis (3)
RedisOutputCacheStore.cs (3)
133if (!await cache.StringSetAsync(gcKey, DateTime.UtcNow.ToString(CultureInfo.InvariantCulture), gcLifetime, when: When.NotExists).ConfigureAwait(false)) 310(long)((DateTime.UtcNow + timeout) - DateTime.UnixEpoch).TotalMilliseconds;
Microsoft.AspNetCore.Routing (3)
Constraints\DateTimeRouteConstraint.cs (3)
16/// Constrains a route parameter to represent only <see cref="DateTime"/> values. 47if (value is DateTime) 61return DateTime.TryParse(valueString, CultureInfo.InvariantCulture, DateTimeStyles.None, out _);
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)
Constraints\DateTimeRouteConstraintTests.cs (1)
16DateTime.Now,
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (3)
ResponseCachingTests.cs (3)
240httpContext.Response.Headers["Expires"] = (DateTime.UtcNow + TimeSpan.FromSeconds(10)).ToString("r"); 307httpContext.Response.Headers["Expires"] = (DateTime.UtcNow + TimeSpan.FromSeconds(10)).ToString("r"); 328httpContext.Response.Headers["Expires"] = (DateTime.UtcNow - TimeSpan.FromSeconds(10)).ToString("r"); // In the past
Microsoft.AspNetCore.Server.IntegrationTesting.IIS (2)
IISDeployer.cs (1)
287var _ = HostProcess.StartTime;
IISExpressDeployer.cs (1)
260var _ = _hostProcess.StartTime;
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (1)
src\Servers\Kestrel\shared\CorrelationIdGenerator.cs (1)
14private static long _lastId = DateTime.UtcNow.Ticks;
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (1)
src\Servers\Kestrel\shared\CorrelationIdGenerator.cs (1)
14private static long _lastId = DateTime.UtcNow.Ticks;
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (1)
src\Servers\Kestrel\shared\CorrelationIdGenerator.cs (1)
14private static long _lastId = DateTime.UtcNow.Ticks;
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (1)
src\Servers\Kestrel\shared\CorrelationIdGenerator.cs (1)
14private static long _lastId = DateTime.UtcNow.Ticks;
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (1)
src\Servers\Kestrel\shared\CorrelationIdGenerator.cs (1)
14private static long _lastId = DateTime.UtcNow.Ticks;
Microsoft.AspNetCore.SignalR.Client.Core (9)
HubConnection.cs (9)
1813var reconnectStartTime = DateTime.UtcNow; 1878Log.Reconnected(_logger, previousReconnectAttempts, DateTime.UtcNow - reconnectStartTime); 1908nextRetryDelay = GetNextRetryDelay(previousReconnectAttempts, DateTime.UtcNow - reconnectStartTime, retryReason); 1917var elapsedTime = DateTime.UtcNow - reconnectStartTime; 2335Volatile.Write(ref _nextActivationSendPing, (DateTime.UtcNow + _hubConnection.KeepAliveInterval).Ticks); 2340Volatile.Write(ref _nextActivationServerTimeout, (DateTime.UtcNow + _hubConnection.ServerTimeout).Ticks); 2351if (DateTime.UtcNow.Ticks > Volatile.Read(ref _nextActivationServerTimeout)) 2356if (DateTime.UtcNow.Ticks > Volatile.Read(ref _nextActivationSendPing) && !Stopping)
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (1)
Startup.cs (1)
137var token = new JwtSecurityToken("SignalRTestServer", "SignalRTests", claims, expires: DateTime.Now.AddSeconds(5), signingCredentials: credentials);
Microsoft.AspNetCore.SignalR.Common.Tests (14)
Internal\Protocol\CustomObject.cs (2)
17public DateTime DateTimeProp { get; set; } = new DateTime(2017, 4, 11, 0, 0, 0, DateTimeKind.Utc); 40DateTime.Equals(DateTimeProp, right.DateTimeProp) &&
Internal\Protocol\JsonHubProtocolTestsBase.cs (7)
278var binder = new TestBinder(new[] { typeof(DateTime) }); 284var dt = Assert.IsType<DateTime>(invocationMessage.Arguments[0]); 293var binder = new TestBinder(typeof(DateTime)); 298var dt = Assert.IsType<DateTime>(invocationMessage.Result); 329DateTimeProp = DateTime.Parse("6/3/2019 10:00:00 PM", CultureInfo.InvariantCulture)
Internal\Protocol\MessagePackHubProtocolTests.cs (5)
31var originalDateTime = new DateTime(2018, 4, 9, 0, 0, 0, dateTimeKind); 38HubProtocol.TryParseMessage(ref bytes, new TestBinder(typeof(DateTime)), out var hubMessage); 42var resultDateTime = (DateTime)completionMessage.Result; 47var expectedUtcDateTime = (originalDateTime.Kind == DateTimeKind.Local) ? originalDateTime.ToUniversalTime() : originalDateTime;
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (2)
src\SignalR\common\Shared\JsonUtils.cs (2)
179if (type == typeof(DateTime) || type == typeof(DateTime?))
Microsoft.AspNetCore.SignalR.Tests (5)
HubConnectionHandlerTests.cs (3)
2707var start = DateTime.UtcNow; 2708while ((DateTime.UtcNow - start).TotalMilliseconds <= 500.0)
Startup.cs (2)
44LifetimeValidator = (before, expires, token, parameters) => expires > DateTime.UtcNow, 109var token = new JwtSecurityToken("SignalRTestServer", "SignalRTests", claims, expires: DateTime.UtcNow.AddMinutes(1), signingCredentials: credentials);
Microsoft.AspNetCore.SignalR.Tests.Utils (3)
src\Shared\SignalR\LogRecord.cs (2)
12public DateTime Timestamp { get; } 15public LogRecord(DateTime timestamp, WriteContext write)
src\Shared\SignalR\LogSinkProvider.cs (1)
35DateTime.Now,
Microsoft.AspNetCore.StaticFiles.FunctionalTests (1)
StaticFileMiddlewareTests.cs (1)
108var last = File.GetLastWriteTimeUtc(Path.Combine(AppContext.BaseDirectory, "TestDocument.txt"));
Microsoft.AspNetCore.StaticFiles.Tests (1)
StaticFileMiddlewareTests.cs (1)
381var responseText = DateTime.UtcNow.Ticks.ToString(CultureInfo.InvariantCulture);
Microsoft.AspNetCore.Testing.Tests (2)
FakeCertificateFactoryTests.cs (2)
21Assert.True(DateTime.Now > certificate.NotBefore + TimeSpan.FromHours(1)); 22Assert.True(DateTime.Now < certificate.NotAfter - TimeSpan.FromHours(1));
Microsoft.Build (156)
BackEnd\BuildManager\BuildManager.cs (5)
248private DateTime _instantiationTimeUtc; 316_instantiationTimeUtc = DateTime.UtcNow; 515DateTime now = DateTime.UtcNow; 1087_buildTelemetry.FinishedAt = DateTime.UtcNow;
BackEnd\Components\BuildRequestEngine\BuildRequestEngine.cs (1)
1450file.WriteLine("{0}({1})-{2}: {3}", Thread.CurrentThread.Name, Environment.CurrentManagedThreadId, DateTime.UtcNow.Ticks, message);
BackEnd\Components\Logging\LoggingContext.cs (1)
154DateTime.UtcNow,
BackEnd\Components\Logging\LoggingServiceLogMethods.cs (1)
662DateTime.UtcNow);
BackEnd\Components\RequestBuilder\IntrinsicTasks\ItemGroupLoggingHelper.cs (2)
274DateTime.UtcNow, 289DateTime timestamp,
BackEnd\Components\RequestBuilder\TargetUpToDateChecker.cs (19)
377DateTime.UtcNow); 388DateTime.UtcNow); 984DateTime oldestOutputFileTime = DateTime.MinValue; 993oldestOutputFileTime = DateTime.MinValue; 996if (oldestOutputFileTime == DateTime.MinValue) 1009DateTime candidateOutputFileTime = DateTime.MinValue; 1018candidateOutputFileTime = DateTime.MinValue; 1021if (candidateOutputFileTime == DateTime.MinValue) 1044DateTime inputFileTime = DateTime.MaxValue; 1053inputFileTime = DateTime.MinValue; 1056if (inputFileTime == DateTime.MinValue) 1203var path1WriteTime = NativeMethodsShared.GetLastWriteFileUtcTime(path1); 1206var path2WriteTime = NativeMethodsShared.GetLastWriteFileUtcTime(path2); 1208path1DoesNotExist = (path1WriteTime == DateTime.MinValue); 1209path2DoesNotExist = (path2WriteTime == DateTime.MinValue); 1231return DateTime.Compare(path1WriteTime, path2WriteTime);
BackEnd\Components\Scheduler\SchedulableRequest.cs (11)
107private DateTime _creationTime; 112private DateTime _startTime; 117private DateTime _endTime; 247public DateTime CreationTime 256ErrorUtilities.VerifyThrow(_creationTime == DateTime.MinValue, "Cannot set CreationTime twice."); 264public DateTime StartTime 273ErrorUtilities.VerifyThrow(_startTime == DateTime.MinValue, "Cannot set StartTime twice."); 281public DateTime EndTime 290ErrorUtilities.VerifyThrow(_endTime == DateTime.MinValue, "Cannot set EndTime twice."); 475DateTime currentTime = DateTime.UtcNow;
BackEnd\Components\Scheduler\Scheduler.cs (18)
304_schedulingData.EventTime = DateTime.UtcNow; 377_schedulingData.EventTime = DateTime.UtcNow; 487_schedulingData.EventTime = DateTime.UtcNow; 521_schedulingData.EventTime = DateTime.UtcNow; 677DateTime schedulingTime = DateTime.UtcNow; 2295DateTime currentEventTime = DateTime.MinValue; 2296DateTime previousEventTime = DateTime.MinValue; 2300DateTime[] nodeStartTimes = new DateTime[_availableNodes.Count]; 2336if (currentEventTime != DateTime.MinValue) 2373if (nodeStartTimes[nodeForEvent] == DateTime.MinValue) 2424private void WriteNodeUtilizationGraphLine(ILoggingService loggingService, BuildEventContext context, int[] currentWork, int[] previousWork, DateTime currentEventTime, DateTime previousEventTime, int invalidWorkId, ref double accumulatedDuration) 2426if (currentEventTime == DateTime.MinValue) 2453if (previousEventTime != DateTime.MinValue)
BackEnd\Components\Scheduler\ScheduleTimeRecord.cs (8)
19private DateTime _startTimeForCurrentState; 31_startTimeForCurrentState = DateTime.MinValue; 42ErrorUtilities.VerifyThrow(_startTimeForCurrentState == DateTime.MinValue, "Can't get the accumulated time while the timer is still running."); 50public void StartState(DateTime currentTime) 52ErrorUtilities.VerifyThrow(_startTimeForCurrentState == DateTime.MinValue, "Cannot start the counter when it is already running."); 59public void EndState(DateTime currentTime) 61if (_startTimeForCurrentState != DateTime.MinValue) 64_startTimeForCurrentState = DateTime.MinValue;
BackEnd\Components\Scheduler\SchedulingData.cs (5)
115private DateTime _currentEventTime; 254public DateTime EventTime 756private DateTime _eventTime; 776public SchedulingEvent(DateTime eventTime, SchedulableRequest request, SchedulableRequestState oldState, SchedulableRequestState newState) 787public DateTime EventTime
BackEnd\Node\PartialBuildTelemetry.cs (3)
14private DateTime _startedAt = default; 18public PartialBuildTelemetry(DateTime startedAt, string? initialServerState, string? serverFallbackReason) 32public DateTime? StartedAt => _startedAt;
BackEnd\Shared\EventsCreatorHelper.cs (1)
22DateTime.UtcNow,
CachingFileSystemWrapper.cs (3)
17private readonly ConcurrentDictionary<string, DateTime> _lastWriteTimeCache = new ConcurrentDictionary<string, DateTime>(); 34public DateTime GetLastWriteTimeUtc(string path)
CommunicationsUtilities.cs (2)
237private static long s_lastLoggedTicks = DateTime.UtcNow.Ticks; 845long now = DateTime.UtcNow.Ticks;
Construction\ProjectRootElement.cs (10)
133/// been changed since being loaded or created, its value is <see cref="DateTime.MinValue"/>. 136private DateTime _timeLastChangedUtc; 143private DateTime _lastWriteTimeWhenReadUtc; 240_timeLastChangedUtc = DateTime.UtcNow; 627/// been changed since being loaded or created, its value is <see cref="DateTime.MinValue"/>. 632public DateTime TimeLastChanged => Link != null ? RootLink.TimeLastChanged : _timeLastChangedUtc.ToLocalTime(); 639public DateTime LastWriteTimeWhenRead => Link != null ? RootLink.LastWriteTimeWhenRead : _lastWriteTimeWhenReadUtc.ToLocalTime(); 641internal DateTime? StreamTimeUtc = null; 1633StreamTimeUtc = DateTime.UtcNow; 1866_timeLastChangedUtc = DateTime.UtcNow;
ExceptionHandling.cs (2)
368writer.WriteLine(DateTime.Now.ToString("G", CultureInfo.CurrentCulture)); 387internal static string ReadAnyExceptionFromFile(DateTime fromTimeUtc)
FileAccess\ProcessData.cs (6)
19private DateTime _creationDateTime; 20private DateTime _exitDateTime; 23public ProcessData(string processName, uint processId, uint parentProcessId, DateTime creationDateTime, DateTime exitDateTime, uint exitCode) 55public DateTime CreationDateTime 62public DateTime ExitDateTime
FileSystem\DirectoryCacheFileSystemWrapper.cs (1)
112public DateTime GetLastWriteTimeUtc(string path) => _fileSystem.GetLastWriteTimeUtc(path);
FileSystem\MSBuildFileSystemBase.cs (1)
70public virtual DateTime GetLastWriteTimeUtc(string path) => FileSystems.Default.GetLastWriteTimeUtc(path);
FileUtilities.cs (1)
172DateTime lastModifiedTime;
IFileSystem.cs (1)
41DateTime GetLastWriteTimeUtc(string path);
Instance\TaskFactories\TaskHostTask.cs (1)
423Debug.WriteLine("[TaskHostTask] Handling packet {0} at {1}", packet.Type, DateTime.Now);
Logging\BaseConsoleLogger.cs (4)
734protected DateTime scopeStartTime; 785elapsedTime += (DateTime.Now - scopeStartTime); 793scopeStartTime = DateTime.Now; 1078internal DateTime buildStarted;
Logging\BinaryLogger\BinaryLogger.cs (1)
514=> $"{DateTime.UtcNow.ToString("yyyyMMdd-HHmmss")}--{EnvironmentUtilities.CurrentProcessId}--{StringUtils.GenerateRandomString(6)}";
Logging\BinaryLogger\BuildEventArgsFields.cs (1)
24public DateTime Timestamp { get; set; }
Logging\BinaryLogger\BuildEventArgsReader.cs (1)
1747private DateTime ReadDateTime()
Logging\BinaryLogger\BuildEventArgsWriter.cs (2)
846if (e.Timestamp != default(DateTime)) 1279private void Write(DateTime timestamp)
Logging\LogFormatter.cs (2)
20internal static string FormatLogTimeStamp(DateTime timeStamp) 39Debug.Assert(timeStamp != DateTime.MinValue, "Timestamp missing");
Logging\ParallelLogger\ParallelConsoleLogger.cs (5)
1361private bool WriteTargetMessagePrefix(BuildEventArgs e, BuildEventContext context, DateTime timeStamp) 1580private void WriteLinePrefix(BuildEventContext e, DateTime eventTimeStamp, bool isMessagePrefix) 1585private void WriteLinePrefix(string key, DateTime eventTimeStamp, bool isMessagePrefix) 1691internal void AddEventStarted(string projectTargetNames, BuildEventContext buildEventContext, DateTime eventTimeStamp, IEqualityComparer<BuildEventContext> comparer) 1718internal void AddEventFinished(string projectTargetNames, BuildEventContext buildEventContext, DateTime eventTimeStamp)
Logging\ParallelLogger\ParallelLoggerHelpers.cs (4)
279private DateTime _timeStamp; 292internal DateTime TimeStamp 417private DateTime _timeStamp; 429internal DateTime TimeStamp
Logging\TerminalLogger\TerminalLogger.cs (3)
105private DateTime _buildStartTime; 176private DateTime? _testStartTime; 181private DateTime? _testEndTime;
LogMessagePacketBase.cs (5)
937DateTime timestamp = responseFileUsedEventArgs.RawTimestamp; 958private static void WriteEvaluationEvent(BuildStatusEventArgs args, string projectFile, DateTime timestamp, ITranslator translator) 1305DateTime timestamp = default; 1347private (BuildEventContext buildEventContext, DateTime timestamp, string projectFile) 1353DateTime timestamp = default;
ManagedFileSystem.cs (1)
134public virtual DateTime GetLastWriteTimeUtc(string path)
MSBuildOnWindowsFileSystem.cs (1)
66public DateTime GetLastWriteTimeUtc(string path)
NodeEndpointOutOfProcBase.cs (4)
356DateTime originalWaitStartTime = DateTime.UtcNow; 361DateTime restartWaitTime = DateTime.UtcNow;
ObjectModelRemoting\ConstructionObjectLinks\ProjectRootElementLink.cs (2)
33public abstract DateTime TimeLastChanged { get; } 38public abstract DateTime LastWriteTimeWhenRead { get; }
Resources\Constants.cs (1)
343availableStaticMethods.TryAdd("System.DateTime", new Tuple<string, Type>(null, typeof(DateTime)));
TaskLoggingHelper.cs (5)
314DateTime.UtcNow, 394DateTime.UtcNow, 450DateTime.UtcNow, 732DateTime.UtcNow, 1103DateTime.UtcNow,
TaskParameter.cs (3)
552DateTime dateTimeParam = _wrappedParameter is DateTime wrappedDateTime ? wrappedDateTime : default; 632TypeCode.DateTime => typeof(DateTime),
Tracing.cs (4)
33private static DateTime s_last = DateTime.MinValue; 113DateTime now = DateTime.Now;
WindowsFileSystem.cs (4)
81public override DateTime GetLastWriteTimeUtc(string path) 83var fileLastWriteTime = NativeMethodsShared.GetLastWriteFileUtcTime(path); 85if (fileLastWriteTime != DateTime.MinValue) 91NativeMethodsShared.GetLastWriteDirectoryUtcTime(path, out var directoryLastWriteTime);
Microsoft.Build.BuildCheck.UnitTests (6)
EndToEndTests.cs (6)
225DateTime File1WriteUtc, 226DateTime File2WriteUtc, 227DateTime File1AccessUtc, 228DateTime File2AccessUtc); 302DateTime file1WriteUtc = File.GetLastWriteTimeUtc(output2.File1Path); 303DateTime file2WriteUtc = File.GetLastWriteTimeUtc(output2.File2Path);
Microsoft.Build.Engine.OM.UnitTests (19)
CachingFileSystemWrapper.cs (3)
17private readonly ConcurrentDictionary<string, DateTime> _lastWriteTimeCache = new ConcurrentDictionary<string, DateTime>(); 34public DateTime GetLastWriteTimeUtc(string path)
ExceptionHandling.cs (2)
368writer.WriteLine(DateTime.Now.ToString("G", CultureInfo.CurrentCulture)); 387internal static string ReadAnyExceptionFromFile(DateTime fromTimeUtc)
FileUtilities.cs (1)
172DateTime lastModifiedTime;
IFileSystem.cs (1)
41DateTime GetLastWriteTimeUtc(string path);
ManagedFileSystem.cs (1)
134public virtual DateTime GetLastWriteTimeUtc(string path)
MSBuildOnWindowsFileSystem.cs (1)
66public DateTime GetLastWriteTimeUtc(string path)
ObjectModelRemoting\LinkedEvaluationModify_Tests.cs (2)
51var lwtBefore = new FileInfo(proj1Path).LastWriteTimeUtc; 70var lwtAfter = new FileInfo(proj1Path).LastWriteTimeUtc;
ObjectModelRemoting\RemoteProjectsProviderMock\ConstructionLinkMocks\MockProjectRootElementLink.cs (4)
34public DateTime TimeLastChanged => this.ProjectXml.TimeLastChanged; 35public DateTime LastWriteTimeWhenRead => this.ProjectXml.LastWriteTimeWhenRead; 198public override DateTime TimeLastChanged => Proxy.TimeLastChanged; 199public override DateTime LastWriteTimeWhenRead => Proxy.LastWriteTimeWhenRead;
WindowsFileSystem.cs (4)
81public override DateTime GetLastWriteTimeUtc(string path) 83var fileLastWriteTime = NativeMethodsShared.GetLastWriteFileUtcTime(path); 85if (fileLastWriteTime != DateTime.MinValue) 91NativeMethodsShared.GetLastWriteDirectoryUtcTime(path, out var directoryLastWriteTime);
Microsoft.Build.Engine.UnitTests (108)
BackEnd\BinaryTranslator_Tests.cs (6)
164HelperTestSimpleType(new DateTime(), DateTime.Now); 165HelperTestSimpleType(DateTime.Now, new DateTime()); 1396private void HelperTestSimpleType(DateTime initialValue, DateTime deserializedInitialValue) 1398DateTime value = initialValue; 1401DateTime deserializedValue = deserializedInitialValue;
BackEnd\EventSourceSink_Tests.cs (1)
752private static TaskParameterEventArgs s_taskParameter = new TaskParameterEventArgs(TaskParameterMessageKind.TaskInput, "ItemName", null, true, DateTime.MinValue);
BackEnd\KnownTelemetry_Tests.cs (7)
60DateTime startAt = new DateTime(2023, 01, 02, 10, 11, 22); 61DateTime innerStartAt = new DateTime(2023, 01, 02, 10, 20, 30); 62DateTime finishedAt = new DateTime(2023, 12, 13, 14, 15, 16); 101buildTelemetry.StartAt = DateTime.MinValue; 106buildTelemetry.FinishedAt = DateTime.MaxValue; 109buildTelemetry.InnerStartAt = DateTime.MinValue; 114buildTelemetry.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\TargetBuilder_Tests.cs (4)
223var now = DateTime.UtcNow; 267var now = DateTime.UtcNow;
BackEnd\TargetUpToDateChecker_Tests.cs (26)
533private readonly DateTime _today = DateTime.Today; 534private readonly DateTime _yesterday = DateTime.Today.AddTicks(-TimeSpan.TicksPerDay); 535private readonly DateTime _twoDaysAgo = DateTime.Today.AddTicks(-2 * TimeSpan.TicksPerDay); 540public DateTime LastWriteTime; 542public FileWriteInfo(string path, DateTime lastWriteTime) 842DateTime? input1Time, 843DateTime? input2Time, 844DateTime? output1Time, 845DateTime? output2Time, 862DateTime? input1Time, 863DateTime? input2Time, 864DateTime? output1Time, 865DateTime? output2Time, 886File.SetLastWriteTime(input1, (DateTime)input1Time); 893File.SetLastWriteTime(input2, (DateTime)input2Time); 900File.SetLastWriteTime(output1, (DateTime)output1Time); 907File.SetLastWriteTime(output2, (DateTime)output2Time); 957private static readonly DateTime Old = new DateTime(2000, 1, 1); 958private static readonly DateTime Middle = new DateTime(2001, 1, 1); 959private static readonly DateTime New = new DateTime(2002, 1, 1); 1016private void SimpleSymlinkInputCheck(DateTime symlinkWriteTime, DateTime targetWriteTime, 1017DateTime outputWriteTime, bool expectedOutOfDate)
BackEnd\TaskBuilderTestTask.cs (7)
44public DateTime ToDateTime(IFormatProvider provider) => Value.ToDateTime(provider); 222private DateTime _dateTimeOutput; 227private DateTime[] _dateTimeArrayOutput; 587public DateTime DateTimeParam 599public DateTime[] DateTimeArrayParam 1039public DateTime DateTimeOutput 1052public DateTime[] DateTimeArrayOutput
BackEnd\TaskRegistry_Tests.cs (4)
1407type = typeof(DateTime[]).FullName; 1448type = typeof(DateTime).FullName; 1529type = typeof(DateTime).FullName; 1535type = typeof(DateTime[]).FullName;
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"));
ConfigureableForwardingLogger_Tests.cs (1)
26private readonly TaskParameterEventArgs _taskParameter = new TaskParameterEventArgs(TaskParameterMessageKind.TaskInput, "ItemName", null, true, DateTime.MinValue);
Evaluation\Evaluator_Tests.cs (6)
4669File.SetLastWriteTime(project1.ProjectFile, DateTime.Now.AddHours(-1)); 4670File.SetLastWriteTime(project2.ProjectFile, DateTime.Now); 4671File.SetLastWriteTime(primaryProject.ProjectFile, DateTime.Now.AddHours(-1)); 4698File.SetLastWriteTime(project1.ProjectFile, DateTime.Now.AddHours(-1)); 4699File.SetLastWriteTime(project2.ProjectFile, DateTime.Now.AddHours(-1)); 4700File.SetLastWriteTime(primaryProject.ProjectFile, DateTime.Now);
Evaluation\Expander_Tests.cs (4)
2754Assert.Equal(System.DateTime.Parse(_dateToParse).ToString("yyyy/MM/dd HH:mm:ss"), result); 2769Assert.Equal(System.DateTime.Parse(_dateToParse).ToString("MM.dd.yyyy"), result); 2784Assert.Equal(DateTime.Now.ToString("MM.dd.yyyy"), result); 2843Assert.Equal(DateTime.Parse(_dateToParse).ToString("yyyy/MM/dd HH:mm:ss"), result);
Evaluation\ProjectRootElementCache_Tests.cs (2)
124File.SetLastWriteTime(path, DateTime.Now + new TimeSpan(1, 0, 0)); 158File.SetLastWriteTime(path, DateTime.Now + new TimeSpan(1, 0, 0));
FileMatcher_Tests.cs (1)
2651public DateTime GetLastWriteTimeUtc(string path) => throw new NotImplementedException();
LogFormatter_Tests.cs (1)
47DateTime testTime = new DateTime(2007 /*Year*/, 08 /*Month*/, 20 /*Day*/, 10 /*Hour*/, 42 /*Minutes*/, 44 /*Seconds*/, 12 /*Milliseconds*/);
TaskParameter_Tests.cs (2)
58[InlineData(typeof(DateTime), (int)TypeCode.DateTime, "1/1/2000 12:12:12")] 93[InlineData(typeof(DateTime), (int)TypeCode.DateTime, "1/1/2000 12:12:12;2/2/2000 13:13:13")]
Telemetry\OpenTelemetryActivities_Tests.cs (3)
99var now = DateTime.UtcNow; 111var originalStartTime = activity.StartTimeUtc; // should be default (min) if not started
TerminalLogger_Tests.cs (4)
43private readonly DateTime _buildStartTime = new DateTime(2023, 3, 30, 16, 30, 0); 44private readonly DateTime _targetStartTime = new DateTime(2023, 3, 30, 16, 30, 1); 45private readonly DateTime _messageTime = new DateTime(2023, 3, 30, 16, 30, 2); 46private readonly DateTime _buildFinishTime = new DateTime(2023, 3, 30, 16, 30, 5);
Microsoft.Build.Framework (133)
AssemblyLoadBuildEventArgs.cs (1)
27: base(null, null, null, importance, DateTime.UtcNow, null)
BinaryReaderExtensions.cs (2)
60public static DateTime ReadTimestamp(this BinaryReader reader) 64var timestamp = new DateTime(timestampTicks, kind);
BinaryTranslator.cs (8)
396public void Translate(ref DateTime value) 767public void TranslateDictionary(ref Dictionary<string, DateTime> dictionary, StringComparer comparer) 777DateTime val = DateTime.MinValue; 1194public void Translate(ref DateTime value) 1568public void TranslateDictionary(ref Dictionary<string, DateTime> dictionary, StringComparer comparer) 1577foreach (KeyValuePair<string, DateTime> kvp in dictionary) 1580DateTime val = kvp.Value;
BinaryWriterExtensions.cs (1)
49public static void WriteTimestamp(this BinaryWriter writer, DateTime timestamp)
BuildCanceledEventArgs.cs (3)
19: this(message, DateTime.UtcNow) 30DateTime eventTimestamp) 43DateTime eventTimestamp,
BuildErrorEventArgs.cs (4)
96: this(subcategory, code, file, lineNumber, columnNumber, endLineNumber, endColumnNumber, message, helpKeyword, senderName, DateTime.UtcNow) 125DateTime eventTimestamp) 158DateTime eventTimestamp, 193DateTime eventTimestamp,
BuildEventArgs.cs (7)
43private DateTime timestamp; 46private DateTime? _localTimestamp; 63: this(null, null, null, DateTime.UtcNow) 74: this(message, helpKeyword, senderName, DateTime.UtcNow) 85protected BuildEventArgs(string? message, string? helpKeyword, string? senderName, DateTime eventTimestamp) 97public DateTime Timestamp 120protected internal DateTime RawTimestamp
BuildFinishedEventArgs.cs (3)
46: this(message, helpKeyword, succeeded, DateTime.UtcNow) 61DateTime eventTimestamp) 79DateTime 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,
BuildStartedEventArgs.cs (4)
41: this(message, helpKeyword, DateTime.UtcNow) 57: this(message, helpKeyword, DateTime.UtcNow) 71DateTime eventTimestamp) 87DateTime eventTimestamp,
BuildStatusEventArgs.cs (3)
42: this(message, helpKeyword, senderName, DateTime.UtcNow) 59DateTime eventTimestamp) 77DateTime eventTimestamp,
BuildSubmissionStartedEventArgs.cs (1)
33: base("", null, null, DateTime.UtcNow)
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,
CustomBuildEventArgs.cs (3)
46: this(message, helpKeyword, senderName, DateTime.UtcNow) 62DateTime eventTimestamp) 80DateTime 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;
ExternalProjectFinishedEventArgs.cs (2)
49: this(message, helpKeyword, senderName, projectFile, succeeded, DateTime.UtcNow) 68DateTime eventTimestamp)
ExternalProjectStartedEventArgs.cs (2)
49: this(message, helpKeyword, senderName, projectFile, targetNames, DateTime.UtcNow) 68DateTime eventTimestamp)
ImmutableFilesTimestampCache.cs (3)
17private readonly ConcurrentDictionary<string, DateTime> _cache = new(StringComparer.OrdinalIgnoreCase); 28public bool TryGetValue(string fullPath, out DateTime lastModified) => _cache.TryGetValue(fullPath, out lastModified); 33public void TryAdd(string fullPath, DateTime lastModified) => _cache.TryAdd(fullPath, lastModified);
ITranslator.cs (2)
217void Translate(ref DateTime value); 325void TranslateDictionary(ref Dictionary<string, DateTime> dictionary, StringComparer comparer);
LazyFormattedBuildEventArgs.cs (2)
50: this(message, helpKeyword, senderName, DateTime.Now, null) 66DateTime eventTimestamp,
MetaProjectGeneratedEventArgs.cs (1)
27: base(message, null, null, MessageImportance.Low, DateTime.UtcNow, metaprojectPath)
NativeMethods.cs (21)
63internal static DateTime MinFileDate { get; } = DateTime.FromFileTimeUtc(0); 983internal static bool GetLastWriteDirectoryUtcTime(string fullPath, out DateTime fileModifiedTimeUtc) 989fileModifiedTimeUtc = DateTime.MinValue; 998fileModifiedTimeUtc = DateTime.FromFileTimeUtc(dt); 1017fileModifiedTimeUtc = DateTime.MinValue; 1153internal static DateTime GetLastWriteFileUtcTime(string fullPath) 1164if (ImmutableFilesTimestampCache.Shared.TryGetValue(fullPath, out DateTime modifiedAt)) 1170DateTime modifiedTime = LastWriteFileUtcTime(fullPath); 1172if (isNonModifiable && modifiedTime != DateTime.MinValue) 1182DateTime LastWriteFileUtcTime(string path) 1184DateTime fileModifiedTime = DateTime.MinValue; 1199fileModifiedTime = DateTime.FromFileTimeUtc(dt); 1214: DateTime.MinValue; 1246private static DateTime GetContentLastWriteFileUtcTime(string fullPath) 1248DateTime fileModifiedTime = DateTime.MinValue; 1260DateTime.FromFileTimeUtc(fileTime); 1327DateTime myStartTime = thisProcess.StartTime; 1445internal static List<KeyValuePair<int, SafeProcessHandle>> GetChildProcessIds(int parentProcessId, DateTime parentStartTime)
ProjectEvaluationFinishedEventArgs.cs (1)
27: base(message, helpKeyword: null, senderName: null, DateTime.UtcNow, messageArgs)
ProjectEvaluationStartedEventArgs.cs (1)
25: base(message, helpKeyword: null, senderName: null, DateTime.UtcNow, messageArgs)
ProjectFinishedEventArgs.cs (2)
44: this(message, helpKeyword, projectFile, succeeded, DateTime.UtcNow) 62DateTime eventTimestamp)
ProjectImportedEventArgs.cs (1)
48eventTimestamp: DateTime.UtcNow,
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,
TargetSkippedEventArgs.cs (1)
77eventTimestamp: DateTime.UtcNow,
TargetStartedEventArgs.cs (3)
48: this(message, helpKeyword, targetName, projectFile, targetFile, String.Empty, TargetBuiltReason.None, DateTime.UtcNow) 69DateTime eventTimestamp) 97DateTime eventTimestamp)
TaskCommandLineEventArgs.cs (2)
48: this(commandLine, taskName, importance, DateTime.UtcNow) 67DateTime eventTimestamp)
TaskFinishedEventArgs.cs (2)
50: this(message, helpKeyword, projectFile, taskFile, taskName, succeeded, DateTime.UtcNow) 72DateTime eventTimestamp)
TaskParameterEventArgs.cs (2)
42DateTime eventTimestamp) 61DateTime 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,
Telemetry\ActivityExtensions.cs (1)
53public static Activity WithStartTime(this Activity activity, DateTime? startTime)
Telemetry\BuildTelemetry.cs (3)
24public DateTime? StartAt { get; set; } 33public DateTime? InnerStartAt { get; set; } 38public DateTime? FinishedAt { get; set; }
Microsoft.Build.Framework.UnitTests (92)
BuildCanceledEventArgs_Tests.cs (2)
17var datetime = DateTime.Today;
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);
EventArgs_Tests.cs (1)
155public GenericBuildEventArgs(string message, string helpKeyword, string senderName, DateTime eventTimeStamp)
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);
ProjectFinishedEventArgs_Tests.cs (2)
25projectFinishedEvent = new ProjectFinishedEventArgs("Message", "HelpKeyword", "ProjectFile", true, DateTime.Now); 27projectFinishedEvent = new ProjectFinishedEventArgs(null, null, null, true, 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);
TaskCommandLineEventArgs_Tests.cs (2)
26taskCommandLineEvent = new TaskCommandLineEventArgs("Commandline", "taskName", MessageImportance.High, DateTime.Now); 28taskCommandLineEvent = new TaskCommandLineEventArgs(null, null, MessageImportance.High, 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 (66)
CachingFileSystemWrapper.cs (3)
17private readonly ConcurrentDictionary<string, DateTime> _lastWriteTimeCache = new ConcurrentDictionary<string, DateTime>(); 34public DateTime GetLastWriteTimeUtc(string path)
Delegate.cs (3)
32internal delegate void SetLastAccessTime(string path, DateTime timestamp); 37internal delegate void SetLastWriteTime(string path, DateTime timestamp); 127internal delegate DateTime GetLastWriteTime(string path);
DependencyFile.cs (3)
29internal DateTime lastModified; 45internal DateTime LastModified 97DateTime curLastModified = info.LastWriteTime;
ExceptionHandling.cs (2)
368writer.WriteLine(DateTime.Now.ToString("G", CultureInfo.CurrentCulture)); 387internal static string ReadAnyExceptionFromFile(DateTime fromTimeUtc)
FileState.cs (4)
62public readonly DateTime LastWriteTimeUtc; 138DateTime.FromFileTimeUtc(((long)data.ftLastWriteTimeHigh << 0x20) | data.ftLastWriteTimeLow); 280internal DateTime LastWriteTime => LastWriteTimeUtcFast.ToLocalTime(); 287internal DateTime LastWriteTimeUtcFast
FileUtilities.cs (1)
172DateTime lastModifiedTime;
GenerateResource.cs (15)
119private DateTime _newestUncorrelatedInputWriteTime; 1503if (_newestUncorrelatedInput != null && _newestUncorrelatedInputWriteTime == DateTime.MinValue) 1510DateTime outputTime = NativeMethodsShared.GetLastWriteFileUtcTime(outputFilePath); 1520DateTime sourceTime = NativeMethodsShared.GetLastWriteFileUtcTime(sourceFilePath); 1566DateTime linkedFileTime = NativeMethodsShared.GetLastWriteFileUtcTime(linkedFilePath); 1568if (linkedFileTime == DateTime.MinValue) 1592private bool NeedToRebuildSourceFile(string sourceFilePath, DateTime sourceTime, string outputFilePath, DateTime outputTime) 1594if (outputTime == DateTime.MinValue) 1653DateTime sourceTime = NativeMethodsShared.GetLastWriteFileUtcTime(Sources[0].ItemSpec); 1654DateTime outputTime = NativeMethodsShared.GetLastWriteFileUtcTime(StronglyTypedFileName); 1656if (sourceTime == DateTime.MinValue) 1663else if (outputTime == DateTime.MinValue) 1712DateTime time = NativeMethodsShared.GetLastWriteFileUtcTime(input.ItemSpec); 1714if (time == DateTime.MinValue)
GetSDKReferenceFiles.cs (2)
1088DateTime referencesCacheFileLastWriteTimeUtc = File.GetLastWriteTimeUtc(referencesCacheFile); 1099DateTime currentCodeLastWriteTime = File.GetLastWriteTimeUtc(codeBase.LocalPath);
IFileSystem.cs (1)
41DateTime GetLastWriteTimeUtc(string path);
ManagedFileSystem.cs (1)
134public virtual DateTime GetLastWriteTimeUtc(string path)
ManifestUtil\mansign2.cs (3)
1369private DateTime _timestampTime; 1379_timestampTime = DateTime.FromFileTime(dt); 1402internal DateTime TimestampTime
MSBuildOnWindowsFileSystem.cs (1)
66public DateTime GetLastWriteTimeUtc(string path)
SystemState.cs (14)
54private Dictionary<string, DateTime> instanceLocalLastModifiedCache = new Dictionary<string, DateTime>(StringComparer.OrdinalIgnoreCase); 123private DateTime lastModified; 153internal FileState(DateTime lastModified) 185internal DateTime LastModified 223internal static DateTime ImmutableFileLastModifiedMarker => DateTime.MaxValue; 380DateTime lastModified = GetAndCacheLastModified(path); 418private DateTime GetAndCacheLastModified(string path) 420if (!instanceLocalLastModifiedCache.TryGetValue(path, out DateTime lastModified)) 429private FileState InitializeFileState(string path, DateTime lastModified) 662DateTime lastModified = GetAndCacheLastModified(path); 666private bool FileTimestampIndicatesFileExists(DateTime lastModified) 669return lastModified != DateTime.MinValue && lastModified != NativeMethodsShared.MinFileDate;
Touch.cs (5)
76DateTime touchDateTime; 191DateTime dt, 294private DateTime GetTouchDateTime() 300return DateTime.Now; 303return DateTime.Parse(Time, DateTimeFormatInfo.InvariantInfo);
Tracing.cs (4)
33private static DateTime s_last = DateTime.MinValue; 113DateTime now = DateTime.Now;
WindowsFileSystem.cs (4)
81public override DateTime GetLastWriteTimeUtc(string path) 83var fileLastWriteTime = NativeMethodsShared.GetLastWriteFileUtcTime(path); 85if (fileLastWriteTime != DateTime.MinValue) 91NativeMethodsShared.GetLastWriteDirectoryUtcTime(path, out var directoryLastWriteTime);
Microsoft.Build.Tasks.UnitTests (60)
AssemblyDependency\ResolveAssemblyReferenceCacheSerialization.cs (3)
23private static readonly DateTime s_now = DateTime.Now; 43private static DateTime GetLastWriteTime(string path) => path switch
AssemblyDependency\ResolveAssemblyReferenceTestFixture.cs (3)
2921private static DateTime GetLastWriteTime(string path) 2923return fileExists(path) ? DateTime.FromFileTimeUtc(1) : DateTime.FromFileTimeUtc(0);
Copy_Tests.cs (2)
578DateTime testTime = DateTime.Now;
FileStateTests.cs (5)
43Assert.Throws<ArgumentException>(() => { var time = state.LastWriteTime; }); 50delegate () { var x = new FileInfo(new String('x', 5000)).LastWriteTime; }, 51delegate () { var x = new FileState(new String('x', 5000)).LastWriteTime; }); 241var time = new DateTime(2111, 1, 1); 267var time = new DateTime(2111, 1, 1);
GenerateBindingRedirects_Tests.cs (2)
293var oldTimestamp = DateTime.Now.Subtract(TimeSpan.FromDays(30));
NativeMethodsShared_Tests.cs (6)
78DateTime nonexistentFileTime = NativeMethodsShared.GetLastWriteFileUtcTime(nonexistentFile); 79Assert.Equal(DateTime.MinValue, nonexistentFileTime); 91DateTime directoryTime = NativeMethodsShared.GetLastWriteFileUtcTime(directory); 92Assert.Equal(DateTime.MinValue, directoryTime); 104DateTime directoryTime; 106Assert.Equal(DateTime.MinValue, directoryTime);
RARPrecomputedCache_Tests.cs (8)
24DateTime now = DateTime.Now; 59DateTime now = DateTime.Now; 77new SystemState.FileState(DateTime.Now) 118{ Path.Combine(precomputedCache.Path, "..", "assembly1", "assembly1"), new SystemState.FileState(DateTime.Now) }, 119{ Path.Combine(precomputedCache.Path, "assembly2"), new SystemState.FileState(DateTime.Now) { Assembly = new Shared.AssemblyNameExtension("hi") } }, 120{ dllName, new SystemState.FileState(DateTime.Now) {
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));
Touch_Tests.cs (2)
138private static void SetLastAccessTime(string path, DateTime timestamp) 163private static void SetLastWriteTime(string path, DateTime timestamp)
WriteLinesToFile_Tests.cs (4)
122var writeTime = DateTime.Now.AddHours(-1); 205var writeTime = DateTime.Now.AddHours(-1);
XmlPeek_Tests.cs (1)
363string dir = Path.Combine(Path.GetTempPath(), DateTime.Now.Ticks.ToString());
XmlPoke_Tests.cs (1)
333string dir = Path.Combine(Path.GetTempPath(), DateTime.Now.Ticks.ToString());
XslTransformation_Tests.cs (1)
1107dir = Path.Combine(Path.GetTempPath(), DateTime.Now.Ticks.ToString());
Microsoft.Build.UnitTests.Shared (4)
ObjectModelHelpers.cs (4)
991File.SetLastWriteTime(projectFileFullPath, DateTime.Now); 1061return GetTempFiles(number, DateTime.Now); 1067public static string[] GetTempFiles(int number, DateTime lastWriteTime) 2280public override DateTime GetLastWriteTimeUtc(string path)
Microsoft.Build.Utilities.Core (24)
CachingFileSystemWrapper.cs (3)
17private readonly ConcurrentDictionary<string, DateTime> _lastWriteTimeCache = new ConcurrentDictionary<string, DateTime>(); 34public DateTime GetLastWriteTimeUtc(string path)
ExceptionHandling.cs (2)
368writer.WriteLine(DateTime.Now.ToString("G", CultureInfo.CurrentCulture)); 387internal static string ReadAnyExceptionFromFile(DateTime fromTimeUtc)
FileUtilities.cs (1)
172DateTime lastModifiedTime;
IFileSystem.cs (1)
41DateTime GetLastWriteTimeUtc(string path);
LockCheck.cs (2)
206StartTime = DateTime.FromFileTime((((long)processInfo.Process.ProcessStartTime.dwHighDateTime) << 32) | 217public DateTime StartTime { get; }
ManagedFileSystem.cs (1)
134public virtual DateTime GetLastWriteTimeUtc(string path)
MSBuildOnWindowsFileSystem.cs (1)
66public DateTime GetLastWriteTimeUtc(string path)
TaskLoggingHelper.cs (5)
314DateTime.UtcNow, 394DateTime.UtcNow, 450DateTime.UtcNow, 732DateTime.UtcNow, 1103DateTime.UtcNow,
Tracing.cs (4)
33private static DateTime s_last = DateTime.MinValue; 113DateTime now = DateTime.Now;
WindowsFileSystem.cs (4)
81public override DateTime GetLastWriteTimeUtc(string path) 83var fileLastWriteTime = NativeMethodsShared.GetLastWriteFileUtcTime(path); 85if (fileLastWriteTime != DateTime.MinValue) 91NativeMethodsShared.GetLastWriteDirectoryUtcTime(path, out var directoryLastWriteTime);
Microsoft.Build.Utilities.UnitTests (6)
NativeMethodsShared_Tests.cs (6)
78DateTime nonexistentFileTime = NativeMethodsShared.GetLastWriteFileUtcTime(nonexistentFile); 79Assert.Equal(DateTime.MinValue, nonexistentFileTime); 91DateTime directoryTime = NativeMethodsShared.GetLastWriteFileUtcTime(directory); 92Assert.Equal(DateTime.MinValue, directoryTime); 104DateTime directoryTime; 106Assert.Equal(DateTime.MinValue, directoryTime);
Microsoft.CodeAnalysis (32)
CodeGen\MetadataConstant.cs (1)
34Debug.Assert(value == null || value is string || value is DateTime || value is decimal || value.GetType().GetTypeInfo().IsEnum || (value.GetType().GetTypeInfo().IsPrimitive && !(value is IntPtr) && !(value is UIntPtr)));
Compilation\CompilationOptions.cs (3)
162/// If equal to default(<see cref="DateTime"/>) the actual current local time will be used. 164internal DateTime CurrentLocalTime { get; private protected set; } 286DateTime currentLocalTime,
ConstantValue.cs (4)
74public virtual DateTime DateTimeValue { get { throw new InvalidOperationException(); } } 345public static ConstantValue Create(DateTime value) 347if (value == default(DateTime)) 392case ConstantValueTypeDiscriminator.DateTime: return Create((DateTime)value);
ConstantValueSpecialized.cs (5)
272private readonly DateTime _value; 274public ConstantValueDateTime(DateTime value) 292public override DateTime DateTimeValue 417public override DateTime DateTimeValue 421return default(DateTime);
DiaSymReader\Writer\ISymUnmanagedWriter.cs (3)
73/// so that we can do custom marshalling of <see cref="System.DateTime"/>. Unfortunately, .NET marshals 74/// <see cref="System.DateTime"/>s as the number of days since 1899/12/30, whereas the native VB compiler 147public VariantStructure(DateTime date) : this() // Need this to avoid errors about the uninteresting union fields.
DiaSymReader\Writer\SymUnmanagedWriterImpl.cs (1)
328case DateTime dateTime:
FileKey.cs (2)
21public readonly DateTime Timestamp; 28public FileKey(string fullPath, DateTime timestamp)
FileSystem\FileUtilities.cs (2)
394internal static DateTime GetFileTimeStamp(string fullPath) 435internal static void GetFileLengthAndTimeStamp(string fullPath, out long fileLength, out DateTime timeStamp)
MetadataReader\PEModule.cs (2)
1604if (value < DateTime.MinValue.Ticks || value > DateTime.MaxValue.Ticks)
PEWriter\MetadataWriter.PortablePdb.cs (2)
193else if (value is DateTime) 198builder.WriteDateTime((DateTime)value);
SpecialType.cs (1)
191/// Indicates that the type is <see cref="DateTime"/>.
SpecialTypeExtensions.cs (1)
341if (value.GetType() == typeof(DateTime))
Symbols\Attributes\CommonAttributeData.cs (2)
245if (value < DateTime.MinValue.Ticks || value > DateTime.MaxValue.Ticks)
VersionHelper.cs (3)
170public static Version? GenerateVersionFromPatternAndCurrentTime(DateTime time, Version pattern) 180if (time == default(DateTime)) 182time = DateTime.Now;
Microsoft.CodeAnalysis.CodeStyle (6)
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
394internal static DateTime GetFileTimeStamp(string fullPath) 435internal static void GetFileLengthAndTimeStamp(string fullPath, out long fileLength, out DateTime timeStamp)
src\Compilers\Core\Portable\SpecialTypeExtensions.cs (1)
341if (value.GetType() == typeof(DateTime))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (1)
212return DateTime.FromBinary(ReadInt64());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
273else if (value.GetType() == typeof(DateTime)) 276_writer.Write(((DateTime)value).ToBinary());
Microsoft.CodeAnalysis.CSharp (4)
CSharpCompilationOptions.cs (2)
205DateTime currentLocalTime, 522internal CSharpCompilationOptions WithCurrentLocalTime(DateTime value)
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (1)
783/// The error will be suppressed only for conversions from <see cref="decimal"/> or <see cref="DateTime"/>.
Symbols\Compilation_WellKnownMembers.cs (1)
479internal SynthesizedAttributeData? SynthesizeDateTimeConstantAttribute(DateTime value)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ParameterGenerator.cs (1)
99if (defaultValue is DateTime)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (34)
Completion\CompletionProviders\EnumAndCompletionListTagCompletionProviderTests.cs (33)
188[InlineData(nameof(DateTime))] 211[InlineData(nameof(DateTime))] 237[InlineData(nameof(DateTime))] 261[InlineData(nameof(DateTime))] 283[InlineData(nameof(DateTime))] 305[InlineData(nameof(DateTime))] 323[InlineData(nameof(DateTime))] 341[InlineData(nameof(DateTime))] 359[InlineData(nameof(DateTime))] 377[InlineData(nameof(DateTime))] 395[InlineData(nameof(DateTime))] 413[InlineData(nameof(DateTime))] 431[InlineData(nameof(DateTime))] 454[InlineData(nameof(DateTime))] 1473[InlineData(nameof(DateTime), nameof(DateTime.Now))] 1494[InlineData(nameof(DateTime), nameof(DateTime.Now))] 1516[InlineData(nameof(DateTime), nameof(DateTime.Now))] 1546[InlineData(nameof(DateTime), nameof(DateTime.Now))] 1576[InlineData(nameof(DateTime))] 1611[InlineData(nameof(DateTime))] 1776[InlineData(nameof(DateTime))] 1796[InlineData(nameof(DateTime), nameof(DateTime.Now))] 1820[InlineData(nameof(DateTime), nameof(DateTime.Now))] 1913[InlineData(nameof(DateTime), nameof(DateTime.Now))] 1935[InlineData(nameof(DateTime), nameof(DateTime.Now))]
Workspaces\WorkspaceTests_EditorFeatures.cs (1)
1452Assert.Throws<ArgumentException>(() => VersionStamp.Create(DateTime.Now));
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (1)
Emit\LocalStateTracing\LocalStateTracingTests.cs (1)
1307private struct S3 { System.DateTime X; System.Guid Y; decimal Z; unsafe void* P; }
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (4)
Attributes\AttributeTests_Assembly.cs (2)
65var now = DateTime.Now;
Semantics\PatternMatchingTests.cs (2)
4908int dt = (int)Math.Abs(DateTime.Now.Ticks % 1000000000); 4921int dt = (int)Math.Abs(DateTime.Now.Ticks % 1000000000);
Microsoft.CodeAnalysis.CSharp.Scripting (1)
Hosting\ObjectFormatter\CSharpPrimitiveFormatter.cs (1)
91protected override string FormatLiteral(DateTime value, CultureInfo cultureInfo = null)
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (2)
ObjectFormatterTests.cs (2)
1059public static void Method(ref char c, out DateTime d) 1079DateTime date;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (4)
Semantics\ConstantTests.cs (1)
4022dateTimeConst = ConstantValue.Create(DateTime.MaxValue),
Semantics\OverloadResolutionTests.cs (3)
6831var start = DateTime.UtcNow; 6833var elapsed = DateTime.UtcNow - start;
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (2)
Compilation\CSharpCompilationOptionsTests.cs (2)
402DateTime currentLocalTime = default(DateTime);
Microsoft.CodeAnalysis.CSharp.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ParameterGenerator.cs (1)
99if (defaultValue is DateTime)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (2)
CodeGeneration\CodeGenerationTests.CSharp.cs (2)
144parameters: Parameters(Parameter(typeof(DateTime), "dt"), Parameter(typeof(int), "i"))); 548returnType: typeof(DateTime));
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (1)
src\Test\PdbUtilities\Shared\DateTimeUtilities.cs (1)
16internal static DateTime ToDateTime(double raw)
Microsoft.CodeAnalysis.ExpressionEvaluator.FunctionResolver (1)
src\Compilers\Core\Portable\SpecialType.cs (1)
191/// Indicates that the type is <see cref="DateTime"/>.
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider (1)
src\Test\PdbUtilities\Shared\DateTimeUtilities.cs (1)
16internal static DateTime ToDateTime(double raw)
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.Utilities (1)
src\Test\PdbUtilities\Shared\DateTimeUtilities.cs (1)
16internal static DateTime ToDateTime(double raw)
Microsoft.CodeAnalysis.ExternalAccess.FSharp (1)
LanguageServices\FSharpVisualStudioWorkspaceExtensions.cs (1)
15public static Metadata GetMetadata(this VisualStudioWorkspace workspace, string fullPath, DateTime snapshotTimestamp)
Microsoft.CodeAnalysis.Features (6)
EmbeddedLanguages\DateAndTime\EmbeddedCompletionContext.cs (2)
18private static readonly DateTime s_exampleDateTime = DateTime.Parse("2009-06-15T13:45:30.1234567");
EmbeddedLanguages\DateAndTime\LanguageServices\DateAndTimeLanguageDetector.cs (4)
17/// Helper class to detect <see cref="DateTime"/> and <see cref="DateTimeOffset"/> format strings in a document efficiently. 84if (name is not nameof(ToString) and not nameof(DateTime.ParseExact) and not nameof(DateTime.TryParseExact)) 160_dateTimeType ??= _compilation.GetTypeByMetadataName(typeof(DateTime).FullName!);
Microsoft.CodeAnalysis.InteractiveHost (2)
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
394internal static DateTime GetFileTimeStamp(string fullPath) 435internal static void GetFileLengthAndTimeStamp(string fullPath, out long fileLength, out DateTime timeStamp)
Microsoft.CodeAnalysis.LanguageServer.Protocol (2)
Workspaces\LspWorkspaceManager.cs (2)
359.SelectAsArray(tuple => (tuple.identity!.Value, DateTime.Now, tuple.Text)); 438ImmutableArray<(SourceGeneratedDocumentIdentity Identity, DateTime Generated, SourceText Text)> sourceGeneratedDocuments,
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (6)
Ordering\MutatingRequestHandler.cs (2)
34StartTime = DateTime.UtcNow 39response.EndTime = DateTime.UtcNow;
Ordering\NonMutatingRequestHandler.cs (2)
35response.StartTime = DateTime.UtcNow; 44response.EndTime = DateTime.UtcNow;
Ordering\TestResponse.cs (2)
11public DateTime StartTime { get; set; } 12public DateTime EndTime { get; set; }
Microsoft.CodeAnalysis.LanguageServer.UnitTests (1)
src\Workspaces\CoreTestUtilities\Logging\TestOutputLoggerProvider.cs (1)
32testOutputHelper.WriteLine($"[{DateTime.UtcNow:hh:mm:ss.fff}] [{logLevel}] [{categoryName}] {formatter(state, exception)}");
Microsoft.CodeAnalysis.Remote.ServiceHub (4)
Host\RemoteWorkspace.SolutionCreator.cs (1)
90var frozenDocuments = new FixedSizeArrayBuilder<(SourceGeneratedDocumentIdentity identity, DateTime generationDateTime, SourceText text)>(count);
src\VisualStudio\Core\Def\Watson\FaultReporter.cs (3)
315var now = DateTime.UtcNow; 330var lastWrite = File.GetLastWriteTimeUtc(path);
Microsoft.CodeAnalysis.Scripting (3)
Hosting\ObjectFormatter\CommonPrimitiveFormatter.cs (2)
38protected abstract string FormatLiteral(DateTime value, CultureInfo cultureInfo = null); 104return FormatLiteral((DateTime)obj, options.CultureInfo);
Hosting\ObjectFormatter\ObjectFormatterHelpers.cs (1)
345if (type == typeof(DateTime))
Microsoft.CodeAnalysis.Scripting.Desktop.UnitTests (1)
MetadataShadowCopyProviderTests.cs (1)
170File.SetLastWriteTimeUtc(path0, DateTime.Now + TimeSpan.FromHours(1));
Microsoft.CodeAnalysis.Test.Utilities (4)
Compilation\VersionTestHelpers.cs (1)
13public static void GetDefaultVersion(DateTime time, out int days, out int seconds)
Syntax\NodeHelpers.cs (1)
193typeObject == typeof(DateTime) ||
TestHelpers.cs (2)
58if (valueType == typeof(DateTime)) 60return ((DateTime)value).ToString("M/d/yyyy h:mm:ss tt", CultureInfo.InvariantCulture);
Microsoft.CodeAnalysis.TestAnalyzerReference (1)
HelloWorldGenerator.cs (1)
54return "Hello, World @ {{DateTime.UtcNow.ToLocalTime().ToLongTimeString()}}";
Microsoft.CodeAnalysis.UnitTests (8)
Collections\ImmutableSegmentedListTest.cs (3)
45int seed = unchecked((int)DateTime.Now.Ticks); 187int randSeed = unchecked((int)DateTime.Now.Ticks); 216int randSeed = unchecked((int)DateTime.Now.Ticks);
Collections\ImmutablesTestBase.cs (1)
175int seed = unchecked((int)DateTime.Now.Ticks);
CorLibTypesTests.cs (2)
99Assert.Throws<InvalidOperationException>(() => { var c = cv1.DateTimeValue; }); 104Assert.Throws<InvalidOperationException>(() => { var c = cv2.DateTimeValue; });
VersionHelperTests.cs (2)
40var now = DateTime.Now;
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (2)
ExpressionTrees\Sources\ExprLambdaUtils.vb (2)
66If vType Is GetType(DateTime) Then 67valStr = DirectCast(val, DateTime).ToString("M/d/yyyy h:mm:ss tt", CultureInfo.InvariantCulture)
Microsoft.CodeAnalysis.Workspaces (43)
SourceGeneration\IRemoteSourceGenerationService.cs (1)
20[property: DataMember(Order = 2)] DateTime GenerationDateTime);
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
394internal static DateTime GetFileTimeStamp(string fullPath) 435internal static void GetFileLengthAndTimeStamp(string fullPath, out long fileLength, out DateTime timeStamp)
src\Compilers\Core\Portable\SpecialTypeExtensions.cs (1)
341if (value.GetType() == typeof(DateTime))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (1)
212return DateTime.FromBinary(ReadInt64());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
273else if (value.GetType() == typeof(DateTime)) 276_writer.Write(((DateTime)value).ToBinary());
Workspace\Solution\FileTextLoader.cs (4)
103FileUtilities.GetFileLengthAndTimeStamp(Path, out var fileLength, out var prevLastWriteTime); 197FileUtilities.GetFileLengthAndTimeStamp(Path, out var fileLength, out var prevLastWriteTime); 214private TextAndVersion CheckForConcurrentFileWrites(DateTime prevLastWriteTime, TextAndVersion textAndVersion) 220var newLastWriteTime = FileUtilities.GetFileTimeStamp(Path);
Workspace\Solution\Solution.cs (2)
1632SourceGeneratedDocumentIdentity documentIdentity, DateTime generationDateTime, SourceText text) 1645internal Solution WithFrozenSourceGeneratedDocuments(ImmutableArray<(SourceGeneratedDocumentIdentity documentIdentity, DateTime generationDateTime, SourceText text)> documents)
Workspace\Solution\SolutionChanges.cs (1)
88/// Gets changed source generated document ids that were modified with <see cref="Solution.WithFrozenSourceGeneratedDocuments(System.Collections.Immutable.ImmutableArray{ValueTuple{SourceGeneratedDocumentIdentity, DateTime, Text.SourceText}})"/>
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)
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker_Generators.cs (2)
294var generationDateTime = DateTime.Now;
Workspace\Solution\SourceGeneratedDocument.cs (1)
28internal DateTime GenerationDateTime => State.GenerationDateTime;
Workspace\Solution\SourceGeneratedDocumentState.cs (6)
40public readonly DateTime GenerationDateTime; 48DateTime generationDateTime) 60DateTime generationDateTime) 88DateTime generationDateTime) 143DateTime generationDateTime) 205public SourceGeneratedDocumentState WithGenerationDateTime(DateTime generationDateTime)
Workspace\Solution\StateChecksums.cs (2)
27ImmutableArray<DateTime> frozenSourceGeneratedDocumentGenerationDateTimes) 56public ImmutableArray<DateTime> FrozenSourceGeneratedDocumentGenerationDateTimes { get; }
Workspace\Solution\VersionStamp.cs (8)
31private readonly DateTime _utcLastModified; 43private VersionStamp(DateTime utcLastModified) 48private VersionStamp(DateTime utcLastModified, int localIncrement) 53private VersionStamp(DateTime utcLastModified, int localIncrement, int globalIncrement) 69=> new(DateTime.UtcNow); 74public static VersionStamp Create(DateTime utcTimeLastModified) 127var now = DateTime.UtcNow;
Workspace\Workspace_Editor.cs (2)
39private readonly Dictionary<DocumentId, (SourceGeneratedDocumentIdentity identity, DateTime generationDateTime)> _openSourceGeneratedDocumentIdentities = []; 285internal bool TryGetOpenSourceGeneratedDocumentIdentity(DocumentId id, out (SourceGeneratedDocumentIdentity identity, DateTime generationDateTime) documentIdentity)
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (2)
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
394internal static DateTime GetFileTimeStamp(string fullPath) 435internal static void GetFileLengthAndTimeStamp(string fullPath, out long fileLength, out DateTime timeStamp)
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (1)
Logging\TestOutputLoggerProvider.cs (1)
32testOutputHelper.WriteLine($"[{DateTime.UtcNow:hh:mm:ss.fff}] [{logLevel}] [{categoryName}] {formatter(state, exception)}");
Microsoft.CodeAnalysis.Workspaces.UnitTests (10)
ObjectSerializationTests.cs (3)
271private static readonly DateTime _testNow = DateTime.Now; 538Assert.Equal(_testNow, (DateTime)reader.ReadScalarValue());
SolutionTests\SolutionWithSourceGeneratorTests.cs (7)
889identity, DateTime.Now, SourceText.From("// Frozen Document")); 916[(sourceGeneratedDocument1.Identity, DateTime.Now, SourceText.From("// Frozen 1")), (sourceGeneratedDocument2.Identity, DateTime.Now, SourceText.From("// Frozen 2"))]); 1277identity, DateTime.Now, SourceText.From("// Frozen Document")); 1314identity, DateTime.Now, SourceText.From("// Frozen Document")); 1345identity, DateTime.Now, SourceText.From("// Frozen Document")); 1380identity, DateTime.Now, SourceText.From("// Frozen Document"));
Microsoft.CSharp (3)
Microsoft\CSharp\RuntimeBinder\Semantics\GroupToArgsBinder.cs (1)
506optionalArgument = ExprFactory.CreateConstant(dateTimeType, ConstVal.Get(DateTime.FromBinary(cv.Int64Val)));
Microsoft\CSharp\RuntimeBinder\Semantics\Types\PredefinedTypes.cs (1)
153new PredefinedTypeInfo(PredefinedType.PT_DATETIME, typeof(DateTime), "System.DateTime", FUNDTYPE.FT_STRUCT),
Microsoft\CSharp\RuntimeBinder\SymbolTable.cs (1)
1514ConstVal cv = ConstVal.Get(((DateTime)dateAttr.Value).Ticks);
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))
DataFrame.IO.cs (9)
45else if (DateTime.TryParse(columnValue, out DateTime dateResult)) 47result = DetermineType(nbline == 0, typeof(DateTime), result); 86if (a == typeof(DateTime) || b == typeof(DateTime)) 87return typeof(DateTime); 339else if (kind == typeof(DateTime)) 722case DateTime: 723record.Append(((DateTime)value).ToString(cultureInfo));
DataFrameColumnCollection.cs (1)
240throw new ArgumentException(string.Format(Strings.BadColumnCast, column.DataType, typeof(DateTime)));
DataFrameColumns\PrimitiveDataFrameColumns\DateTimeDataFrameColumn.cs (7)
11public partial class DateTimeDataFrameColumn : PrimitiveDataFrameColumn<DateTime> 13public DateTimeDataFrameColumn(string name, IEnumerable<DateTime?> values) : base(name, values) { } 15public DateTimeDataFrameColumn(string name, IEnumerable<DateTime> values) : base(name, values) { } 21internal DateTimeDataFrameColumn(string name, PrimitiveColumnContainer<DateTime> values) : base(name, values) { } 23protected override PrimitiveDataFrameColumn<DateTime> CreateNewColumn(string name, long length = 0) 28internal override PrimitiveDataFrameColumn<DateTime> CreateNewColumn(string name, PrimitiveColumnContainer<DateTime> container)
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)
PrimitiveDataFrameColumn.BinaryOperationAPIs.ExplodedColumns.cs (6)
15778public BooleanDataFrameColumn ElementwiseEquals(DateTime value) 15782public BooleanDataFrameColumn ElementwiseNotEquals(DateTime value) 15786public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(DateTime value) 15790public BooleanDataFrameColumn ElementwiseLessThanOrEqual(DateTime value) 15794public BooleanDataFrameColumn ElementwiseGreaterThan(DateTime value) 15798public BooleanDataFrameColumn ElementwiseLessThan(DateTime value)
PrimitiveDataFrameColumn.BinaryOperationImplementations.Exploded.cs (1)
388internal BooleanDataFrameColumn HandleOperationImplementation(ComparisonOperation operation, DateTime value)
PrimitiveDataFrameColumn.BinaryOperations.cs (14)
48case PrimitiveDataFrameColumn<DateTime> DateTimeColumn: 86case PrimitiveDataFrameColumn<DateTime> DateTimeColumn: 124case PrimitiveDataFrameColumn<DateTime> DateTimeColumn: 162case PrimitiveDataFrameColumn<DateTime> DateTimeColumn: 200case PrimitiveDataFrameColumn<DateTime> DateTimeColumn: 238case PrimitiveDataFrameColumn<DateTime> DateTimeColumn: 276case PrimitiveDataFrameColumn<DateTime> DateTimeColumn: 314case PrimitiveDataFrameColumn<DateTime> DateTimeColumn: 469case PrimitiveDataFrameColumn<DateTime> DateTimeColumn: 521case PrimitiveDataFrameColumn<DateTime> DateTimeColumn: 573case PrimitiveDataFrameColumn<DateTime> DateTimeColumn: 623case PrimitiveDataFrameColumn<DateTime> DateTimeColumn: 673case PrimitiveDataFrameColumn<DateTime> DateTimeColumn: 723case PrimitiveDataFrameColumn<DateTime> DateTimeColumn:
PrimitiveDataFrameColumn.cs (16)
108else if (typeof(T) == typeof(DateTime)) 142if (this.DataType == typeof(DateTime)) 150ReadOnlySpan<DateTime> valueSpan = MemoryMarshal.Cast<T, DateTime>(valueBuffer.ReadOnlySpan); 397return this.IsNumericColumn() || typeof(T) == typeof(DateTime); 809else if (typeof(T) == typeof(DateTime)) 993case Type DateTimeType when DateTimeType == typeof(DateTime): 1071case Type DateTimeType when DateTimeType == typeof(DateTime): 1148case Type DateTimeType when DateTimeType == typeof(DateTime): 1272case Type DateTimeType when DateTimeType == typeof(DateTime): 1310case Type DateTimeType when DateTimeType == typeof(DateTime): 1311if (typeof(U) != typeof(DateTime)) 1381case Type DateTimeType when DateTimeType == typeof(DateTime): 1382if (typeof(U) != typeof(DateTime)) 1386return new BooleanDataFrameColumn(Name, (this as PrimitiveDataFrameColumn<DateTime>)._columnContainer.HandleOperation(operation, Unsafe.As<U, DateTime>(ref value)));
PrimitiveDataFrameColumnComputations.cs (2)
102else if (typeof(T) == typeof(DateTime)) 106else if (typeof(T) == typeof(DateTime))
Microsoft.Data.Analysis.Interactive (1)
DataFrameKernelExtension.cs (1)
42var uniqueId = DateTime.Now.Ticks;
Microsoft.Data.Analysis.Tests (31)
ArrowIntegrationTests.cs (1)
58.Append("Date64Column", false, new Date64Array.Builder().AppendRange(Enumerable.Repeat(DateTime.Now, 10)).Build())
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))
DataFrameTests.Computations.cs (5)
155else if (column.DataType == typeof(DateTime)) 221var maxDate = SampleDateTime.AddDays(100); 229Assert.Equal(maxDate, (DateTime)dateTimeColumn[i]); 324else if (column.DataType == typeof(DateTime)) 395var dateTimeColumn = new DateTimeDataFrameColumn("DateTime", new DateTime?[]
DataFrameTests.cs (3)
762PrimitiveDataFrameColumn<DateTime> dateTimes = new PrimitiveDataFrameColumn<DateTime>("DateTimes"); 765dateTimes.Append(DateTime.Parse("2019/01/01"));
DataFrameTests.Utils.cs (1)
145internal static DateTime SampleDateTime = new DateTime(2021, 06, 04);
Microsoft.DotNet.Arcade.Sdk (6)
src\CheckRequiredDotNetVersion.cs (3)
20public readonly DateTime LastWrite; 23public CacheEntry(DateTime lastWrite, bool success) 45DateTime lastWrite;
src\LocateDotNet.cs (3)
19public readonly DateTime LastWrite; 23public CacheEntry(DateTime lastWrite, string paths, string value) 47var lastWrite = File.GetLastWriteTimeUtc(globalJsonPath);
Microsoft.DotNet.Build.Tasks.Installers (13)
src\BuildFPMToolPreReqs.cs (1)
81str = str.Replace("{DATE}", DateTime.UtcNow.ToString("ddd MMM dd yyyy"));
src\CreateChangelogFile.cs (1)
46writer.WriteLine($" -- {MaintainerName} <{MaintainerEmail}> {DateTime.Now:ddd, dd MMM yyyy HH:mm:ss zzz}");
src\CreateDebPackage.cs (2)
19private static readonly DateTime UnixEpoch = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); 33ulong timestamp = (ulong)(DateTime.UtcNow - UnixEpoch).TotalSeconds;
src\CreateRpmPackage.cs (1)
22private static readonly DateTime UnixEpoch = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
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)
PackageIndexTests.cs (1)
26DateTime originalModifiedTime = File.GetLastWriteTimeUtc(packageIndexFile);
Microsoft.DotNet.Build.Tasks.VisualStudio (3)
OptProf\FindLatestDrop.cs (3)
53DateTime latest = default; 70var timestamp = timestampToken.Value<DateTime>();
Microsoft.DotNet.Git.IssueManager (1)
Models\AzureDevOpsCommit.cs (1)
25public DateTime Date { get; set; }
Microsoft.DotNet.Helix.JobSender (13)
JobDefinition.cs (6)
249DateTime whenItExpires = DateTime.MaxValue; 251if (DateTime.TryParseExact(queueInfo.EstimatedRemovalDate, "yyyy-MM-dd", null, DateTimeStyles.AssumeUniversal, out DateTime dtIso)) 255if (whenItExpires != DateTime.MaxValue) // We recognized a date from the string 257TimeSpan untilRemoved = whenItExpires.ToUniversalTime().Subtract(DateTime.UtcNow);
Payloads\ArchivePayload.cs (1)
53return (alreadyUploadedFile.LastWriteTimeUtc.AddHours(CacheExpiryHours) > DateTime.UtcNow) && // Expiration hasn't elapsed
Payloads\DirectoryPayload.cs (2)
82if (alreadyUploadedFile.LastWriteTimeUtc.AddHours(CacheExpiryHours) < DateTime.UtcNow) 87var newestFileWriteTime = DirectoryInfo.EnumerateFiles("*", SearchOption.AllDirectories)
StorageHelpers\ConnectionStringBlobHelper.cs (4)
41public override string ReadSas => GetSasTokenForPermissions(BlobContainerSasPermissions.Read, DateTime.UtcNow.AddDays(30)); 44DateTime.UtcNow.AddDays(30)); 46private string GetSasTokenForPermissions(BlobContainerSasPermissions permissions, DateTime expiration) 54string sasToken = GetSasTokenForPermissions(BlobContainerSasPermissions.Read, DateTime.UtcNow.AddDays(30));
Microsoft.DotNet.Internal.SymbolHelper (5)
SymbolPromotionHelper.cs (5)
102DateTime expirationDate = DateTime.UtcNow.AddDays(symbolExpirationInDays); 251DateTime expirationDate = DateTime.UtcNow.AddDays(symbolExpirationInDays); 352DateTime? ExpirationTime,
Microsoft.DotNet.Open.Api.Tools.Tests (6)
OpenApiRefreshTests.cs (6)
28var firstWriteTime = File.GetLastWriteTime(expectedJsonPath); 37var secondWriteTime = File.GetLastWriteTime(expectedJsonPath); 58var firstWriteTime = File.GetLastWriteTime(expectedJsonPath); 67var secondWriteTime = File.GetLastWriteTime(expectedJsonPath); 84var firstWriteTime = File.GetLastWriteTime(expectedJsonPath); 93var secondWriteTime = File.GetLastWriteTime(expectedJsonPath);
Microsoft.DotNet.RemoteExecutor (1)
RemoteInvokeHandle.cs (1)
147description.AppendLine($"Timed out at {DateTime.Now} after {Options.TimeOut}ms waiting for remote process.");
Microsoft.DotNet.SignCheckLibrary (33)
Utils.cs (8)
89public static DateTime DateTimeOrDefault(this string timestamp, DateTime defaultValue) 105if (DateTime.TryParse(timestamp, out DateTime dateTime)) 245private static bool TryParseCodeSignTimestamp(string timestamp, out DateTime dateTime) 255if (DateTime.TryParseExact(normalizedTimestamp, codesignFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime)) 266private static bool TryParseOpensslTimestamp(string timestamp, out DateTime dateTime) 282if (DateTime.TryParseExact(normalizedTimestamp, opensslFormat, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal, out dateTime))
Verification\LinuxPackageVerifier.cs (3)
93SignedOn = signatureTimestampsMatch.GroupValueOrDefault("signedOn").DateTimeOrDefault(DateTime.MaxValue), 94ExpiryDate = signatureTimestampsMatch.GroupValueOrDefault("expiresOn").DateTimeOrDefault(DateTime.MaxValue), 96EffectiveDate = keyInfoMatch.GroupValueOrDefault("createdOn").DateTimeOrDefault(DateTime.MaxValue)
Verification\MachOVerifier.cs (13)
92DateTime signedOn = ExtractSignedOnTimestamp(svr); 93IEnumerable<(DateTime effectiveOn, DateTime expiresOn, string algorithm)> certDetails = ExtractCertificateDetails(svr); 101EffectiveDate = DateTime.MaxValue, 102ExpiryDate = DateTime.MinValue, 135private DateTime ExtractSignedOnTimestamp(SignatureVerificationResult svr) 141return timestampRegex.Match(timestampOutput).GroupValueOrDefault("timestamp").DateTimeOrDefault(DateTime.MaxValue); 147private IEnumerable<(DateTime effectiveOn, DateTime expiresOn, string algorithm)> ExtractCertificateDetails(SignatureVerificationResult svr) 171DateTime effectiveOn = effectiveOnRegex.Match(opensslOutput).GroupValueOrDefault("effectiveOn").DateTimeOrDefault(DateTime.MaxValue); 172DateTime expiresOn = expiresOnRegex.Match(opensslOutput).GroupValueOrDefault("expiresOn").DateTimeOrDefault(DateTime.MinValue);
Verification\PkgVerifier.cs (3)
124DateTime signedOnTimestamp = signedOnRegex.Match(signingVerificationOutput).GroupValueOrDefault("timestamp").DateTimeOrDefault(DateTime.MaxValue); 134ExpiryDate = match.GroupValueOrDefault("timestamp").DateTimeOrDefault(DateTime.MinValue),
Verification\Timestamp.cs (6)
10public DateTime EffectiveDate 16public DateTime ExpiryDate 45public DateTime SignedOn 62if (SignedOn == DateTime.MaxValue || ExpiryDate == DateTime.MinValue || EffectiveDate == DateTime.MaxValue)
Microsoft.DotNet.SignCheckTask (4)
src\SignCheck.cs (4)
406DateTime startTime = DateTime.Now; 408DateTime endTime = DateTime.Now;
Microsoft.DotNet.SourceBuild.Tasks (5)
src\UsageReport\WritePackageUsageData.cs (3)
86DateTime startTime = DateTime.Now; 259$"Writing package usage data... done. Took {DateTime.Now - startTime}");
src\UsageReport\WriteUsageReports.cs (1)
197return default(DateTime);
src\WriteBuildOutputProps.cs (1)
110sw.WriteLine($@" <{CreationTimePropertyName}>{DateTime.UtcNow.Ticks}</{CreationTimePropertyName}>");
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)
src\Shared\JsonSchemaExporter\JsonSchemaExporter.cs (1)
606[typeof(DateTime)] = _ => new JsonSchema { Type = JsonSchemaType.String, Format = "date-time" },
Utilities\AIJsonUtilities.Defaults.cs (1)
105[JsonSerializable(typeof(DateTime))]
Microsoft.Extensions.AI.Abstractions.Tests (6)
AdditionalPropertiesDictionaryTests.cs (1)
70AssertNotFound<int, DateTime>(42);
test\Shared\JsonSchemaExporter\TestTypes.cs (4)
82yield return new TestData<DateTime>( 84AdditionalValues: [DateTime.MinValue, DateTime.MaxValue], 1223[JsonSerializable(typeof(DateTime))]
Utilities\AIJsonUtilitiesTests.cs (1)
547Delegate method = (int first, string second, bool third, CancellationToken fourth, DateTime fifth) => { };
Microsoft.Extensions.AI.Evaluation.Integration.Tests (3)
QualityEvaluatorTests.cs (1)
43string date = $"Date: {DateTime.UtcNow:dddd, dd MMMM yyyy}";
ResultsTests.cs (1)
26string date = $"Date: {DateTime.UtcNow:dddd, dd MMMM yyyy}";
SafetyEvaluatorTests.cs (1)
43string date = $"Date: {DateTime.UtcNow:dddd, dd MMMM yyyy}";
Microsoft.Extensions.AI.Evaluation.Reporting (20)
Formats\Dataset.cs (2)
18DateTime createdAt, 22public DateTime CreatedAt { get; } = createdAt;
Formats\Html\HtmlReportWriter.cs (1)
34createdAt: DateTime.UtcNow,
Formats\Json\JsonReportWriter.cs (1)
33createdAt: DateTime.UtcNow,
ScenarioRun.cs (1)
180creationTime: DateTime.UtcNow,
ScenarioRunResult.cs (3)
55DateTime creationTime, 90DateTime creationTime, 127public DateTime CreationTime { get; set; } = creationTime;
Storage\DiskBasedResponseCache.CacheEntry.cs (4)
26DateTime creation, 27DateTime expiration) 33public DateTime Creation { get; } = creation; 34public DateTime Expiration { get; } = expiration;
Storage\DiskBasedResponseCache.cs (5)
31private readonly Func<DateTime> _provideDateTime; 37Func<DateTime> provideDateTime) 289Func<DateTime> provideDateTime, 370DateTime creation = _provideDateTime(); 371DateTime expiration = creation.Add(_options.TimeToLiveForCacheEntries);
Storage\DiskBasedResponseCacheProvider.cs (3)
25private readonly Func<DateTime> _provideDateTime = () => DateTime.UtcNow; 30internal DiskBasedResponseCacheProvider(string storageRootPath, Func<DateTime> provideDateTime)
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (12)
Storage\AzureStorageResponseCache.CacheEntry.cs (4)
29DateTime creation, 30DateTime expiration) 36public DateTime Creation { get; } = creation; 37public DateTime Expiration { get; } = expiration;
Storage\AzureStorageResponseCache.cs (5)
32Func<DateTime> provideDateTime, 45private readonly Func<DateTime> _provideDateTime = provideDateTime; 200Func<DateTime> provideDateTime, 285DateTime creation = _provideDateTime(); 286DateTime expiration = creation.Add(_timeToLiveForCacheEntries);
Storage\AzureStorageResponseCacheProvider.cs (3)
33private readonly Func<DateTime> _provideDateTime = () => DateTime.Now; 40Func<DateTime> provideDateTime,
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (26)
AzureStorage\AzureResponseCacheTests.cs (1)
53internal override IResponseCacheProvider CreateResponseCacheProvider(Func<DateTime> provideDateTime)
CacheEntryTests.cs (8)
23creation: DateTime.UtcNow, 24expiration: DateTime.UtcNow.Add(TimeSpan.FromMinutes(5))); 43creation: DateTime.UtcNow, 44expiration: DateTime.UtcNow.Add(TimeSpan.FromMinutes(5))); 63creation: DateTime.UtcNow, 64expiration: DateTime.UtcNow.Add(TimeSpan.FromMinutes(5))); 84creation: DateTime.UtcNow, 85expiration: DateTime.UtcNow.Add(TimeSpan.FromMinutes(5)));
DiskBased\DiskBasedResponseCacheTests.cs (1)
51internal override IResponseCacheProvider CreateResponseCacheProvider(Func<DateTime> provideDateTime)
ResponseCacheTester.cs (9)
23internal abstract IResponseCacheProvider CreateResponseCacheProvider(Func<DateTime> provideDateTime); 86DateTime now = DateTime.UtcNow; 87DateTime provideDateTime() => now; 99now = DateTime.UtcNow + DiskBasedResponseCache.CacheOptions.Default.TimeToLiveForCacheEntries; 134DateTime now = DateTime.UtcNow; 135DateTime provideDateTime() => now; 147now = DateTime.UtcNow + DiskBasedResponseCache.CacheOptions.Default.TimeToLiveForCacheEntries;
ResultStoreTester.cs (1)
33creationTime: DateTime.UtcNow,
ScenarioRunResultTests.cs (5)
85creationTime: DateTime.UtcNow, 176creationTime: DateTime.UtcNow, 185var dataset = new Dataset([entry], createdAt: DateTime.UtcNow, generatorVersion: "1.2.3.4"); 214creation: DateTime.UtcNow, 215expiration: DateTime.UtcNow.Add(TimeSpan.FromMinutes(5)));
SerializationChainingTests.cs (1)
23creationTime: DateTime.UtcNow,
Microsoft.Extensions.AI.Integration.Tests (2)
ChatClientIntegrationTests.cs (2)
393AIFunctionFactory.Create((DateTime dt) => dt, "Method10"), 394AIFunctionFactory.Create((DateTime? dt) => dt, "Method11"),
Microsoft.Extensions.AI.Tests (5)
ChatCompletion\DistributedCachingChatClientTest.cs (5)
361CreatedAt = DateTime.Parse("2024-10-11T19:23:36.0152137Z"), 392Assert.Equal(DateTime.Parse("2024-10-11T19:23:36.0152137Z"), item.CreatedAt); 611new CustomAIContent1("Hello", DateTime.Now), 811public class CustomAIContent1(string text, DateTime date) : AIContent 814public DateTime Date => date;
Microsoft.Extensions.Caching.Hybrid.Tests (1)
SerializerTests.cs (1)
189Dictionary<string, (int id, string who, DateTime when)> source = new()
Microsoft.Extensions.Caching.Memory (17)
CacheEntry.cs (4)
185internal DateTime LastAccessed { get; set; } 234internal bool CheckExpired(DateTime utcNow) 250private bool CheckForExpiredTime(DateTime utcNow) 259bool FullCheck(DateTime utcNow)
MemoryCache.cs (13)
36private DateTime _lastExpirationScan; 70private DateTime UtcNow => _options.Clock?.UtcNow.UtcDateTime ?? DateTime.UtcNow; 120DateTime utcNow = UtcNow; 267DateTime utcNow = UtcNow; 387private void StartScanForExpiredItemsIfNeeded(DateTime utcNow) 394void ScheduleTask(DateTime utcNow) 466DateTime utcNow = _lastExpirationScan = UtcNow; 586var lowPriEntries = new List<(CacheEntry entry, DateTime lastAccessed)>(); 587var normalPriEntries = new List<(CacheEntry entry, DateTime lastAccessed)>(); 588var highPriEntries = new List<(CacheEntry entry, DateTime lastAccessed)>(); 592DateTime utcNow = UtcNow; 635static void ExpirePriorityBucket(ref long removedSize, long removalSizeTarget, Func<CacheEntry, long> computeEntrySize, List<CacheEntry> entriesToRemove, List<(CacheEntry Entry, DateTime LastAccessed)> priorityEntries)
Microsoft.Extensions.Caching.StackExchangeRedis.Tests (6)
TimeExpirationAsyncTests.cs (3)
250var setTime = DateTime.Now; 263while ((DateTime.Now - setTime).TotalSeconds < 4)
TimeExpirationTests.cs (3)
235var setTime = DateTime.Now; 248while ((DateTime.Now - setTime).TotalSeconds < 4)
Microsoft.Extensions.Compliance.Abstractions.Tests (1)
Redaction\RedactorTest.cs (1)
280var data = new DateTime(1, 2, 3);
Microsoft.Extensions.Diagnostics.Testing.Tests (1)
Logging\FakeLoggerTests.cs (1)
124var dt = new DateTime(2022, 5, 22);
Microsoft.Extensions.FileProviders.Physical (18)
Internal\Clock.cs (2)
16public DateTime UtcNow => DateTime.UtcNow;
Internal\FileSystemInfoHelper.cs (3)
32public static DateTime? GetFileLinkTargetLastWriteTimeUtc(string filePath) 48public static DateTime? GetFileLinkTargetLastWriteTimeUtc(FileInfo fileInfo) 67return DateTime.MinValue;
Internal\IClock.cs (1)
10DateTime UtcNow { get; }
PollingFileChangeToken.cs (7)
24private DateTime _previousWriteTimeUtc; 25private DateTime _lastCheckedTimeUtc; 44private DateTime GetLastWriteTimeUtc() 50return DateTime.MinValue; 92DateTime currentTime = DateTime.UtcNow; 98DateTime lastWriteTimeUtc = GetLastWriteTimeUtc();
PollingWildCardChangeToken.cs (5)
28private DateTime? _lastScanTimeUtc; 122DateTime lastWriteTimeUtc = GetLastWriteUtc(file.Path); 150/// <returns>The <see cref="DateTime"/> that the file was last modified.</returns> 151protected virtual DateTime GetLastWriteUtc(string path) 169private void ComputeHash(IncrementalHash sha256, string path, DateTime lastChangedUtc)
Microsoft.Extensions.Http.Resilience.Tests (2)
artifacts\obj\Microsoft.Extensions.Http.Resilience.Tests\Debug\net8.0\Protos\GreetGrpc.cs (2)
124public virtual global::Microsoft.Extensions.Http.Resilience.Test.Grpc.HelloReply SayHello(global::Microsoft.Extensions.Http.Resilience.Test.Grpc.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) 148public virtual grpc::AsyncUnaryCall<global::Microsoft.Extensions.Http.Resilience.Test.Grpc.HelloReply> SayHelloAsync(global::Microsoft.Extensions.Http.Resilience.Test.Grpc.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
Microsoft.Extensions.Options.Contextual.Tests (1)
AcceptanceTests.cs (1)
74public DateTime Date { get; set; }
Microsoft.Extensions.Telemetry.Abstractions (2)
Enrichment\IEnrichmentTagCollector.cs (2)
35/// <term><see cref="DateTime"/></term> 36/// <description>Recognized and serialized after converting to <see cref="DateTime.ToUniversalTime()"/>.</description>
Microsoft.Extensions.Telemetry.Abstractions.Tests (3)
Logging\TagProviderAttributeTests.cs (3)
16var attr = new TagProviderAttribute(typeof(DateTime), ProviderMethod); 42var attr = new TagProviderAttribute(typeof(DateTime), ProviderMethod); 43Assert.Equal(typeof(DateTime), attr.ProviderType);
Microsoft.Gen.Logging.Generated.Tests (16)
LogMethodTests.cs (1)
828var dt = new DateTime(2022, 5, 22);
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);
test\Generators\Microsoft.Gen.Logging\TestClasses\FormattableTestExtensions.cs (1)
34public readonly DateTime ToDateTime(IFormatProvider? provider) => throw new NotSupportedException();
test\Generators\Microsoft.Gen.Logging\TestClasses\InvariantTestExtensions.cs (1)
12public static partial void M0(ILogger logger, DateTime p0);
test\Generators\Microsoft.Gen.Logging\TestClasses\LogPropertiesExtensions.cs (8)
85public DateTime DateTimeProperty { get; set; } = DateTime.MaxValue; 116public DateTime? NullableDateTime { get; set; } 117public DateTime NonNullableDateTime { get; set; } 143public DateTime GetOnlyProperty => DateTime.MaxValue; 145public DateTime SetOnlyProperty // Not supposed to be logged (write-only property) 222=> DateTime
test\Generators\Microsoft.Gen.Logging\TestClasses\LogPropertiesSpecialTypesExtensions.cs (1)
15public DateTime P0 { get; set; }
Microsoft.Gen.Logging.Unit.Tests (1)
ParserTests.LogProperties.cs (1)
482Assembly.GetAssembly(typeof(DateTime))!,
Microsoft.Maui (4)
Core\IDatePicker.cs (3)
18 DateTime Date { get; set; } 23 DateTime MinimumDate { get; } 28 DateTime MaximumDate { get; }
Platform\TimeExtensions.cs (1)
26 return DateTime.Today.Add(time).ToString(format, cultureInfo);
Microsoft.Maui.Controls (30)
DateChangedEventArgs.cs (4)
10 public DateChangedEventArgs(DateTime oldDate, DateTime newDate) 17 public DateTime NewDate { get; private set; } 20 public DateTime OldDate { get; private set; }
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
ViewExtensions.cs (2)
453 else if (element is DatePicker dp && DateTime.TryParse(text, out DateTime dpResult))
Xaml\TypeConversionExtensions.cs (2)
198 if (toType == typeof(DateTime)) 199 return DateTime.Parse(str, CultureInfo.InvariantCulture);
Microsoft.Maui.Controls.Build.Tasks (2)
NodeILExtensions.cs (2)
272 var dt = TryFormat(s => DateTime.Parse(s, CultureInfo.InvariantCulture), node, str);
Microsoft.Maui.Essentials (13)
Accelerometer\Accelerometer.shared.cs (2)
280 var now = Nanoseconds(DateTime.UtcNow); 300 static long Nanoseconds(DateTime time) =>
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),
Types\Location.shared.cs (1)
104 Timestamp = DateTime.UtcNow;
WebAuthenticator\WebAuthenticatorResult.shared.cs (1)
71 public DateTimeOffset Timestamp { get; set; } = new DateTimeOffset(DateTime.UtcNow);
Microsoft.Maui.Resizetizer (4)
ResizetizeImages.cs (1)
122 File.SetLastWriteTimeUtc(itemSpec, DateTime.UtcNow);
Utils.cs (3)
54 public static (bool Exists, DateTime Modified) FileExists(string path) 57 var modified = exists ? File.GetLastWriteTimeUtc(path) : System.DateTime.MinValue;
Microsoft.ML.AutoML (5)
AutoMLExperiment\AutoMLExperiment.cs (3)
247StartedAtUtc = DateTime.UtcNow, 279trialResult.TrialSettings.EndedAtUtc = DateTime.UtcNow; 306trialSettings.EndedAtUtc = DateTime.UtcNow;
AutoMLExperiment\TrialSettings.cs (2)
25public DateTime StartedAtUtc { get; set; } 29public DateTime? EndedAtUtc { get; set; }
Microsoft.ML.AutoML.Interactive (5)
ActionThrottler.cs (5)
19private DateTime _nextUpdateTime = DateTime.MinValue; 38DateTime currentTime = DateTime.UtcNow; 45_nextUpdateTime = DateTime.UtcNow + _minDelay;
Microsoft.ML.Core (19)
CommandLine\CmdParser.cs (5)
1130typeBase == typeof(DateTime) || 1306else if (type == typeof(System.DateTime)) 1885else if (type == typeof(System.DateTime)) 1887value = System.DateTime.Parse(data); 2219else if (type == typeof(System.DateTime))
Data\ColumnTypeExtensions.cs (1)
103if (type == typeof(DateTime))
Data\DataKind.cs (3)
68/// <summary>type of <see cref="System.DateTime"/>.</summary> 280return typeof(DateTime); 324else if (type == typeof(DateTime))
Data\ProgressReporter.cs (10)
336public readonly DateTime StartTime; 343public readonly ConcurrentQueue<KeyValuePair<DateTime, ProgressEntry>> PendingCheckpoints; 358PendingCheckpoints = new ConcurrentQueue<KeyValuePair<DateTime, ProgressEntry>>(); 359StartTime = DateTime.UtcNow; 581public readonly DateTime StartTime; 582public readonly DateTime EventTime; 586public ProgressEvent(int index, string name, DateTime startTime, ProgressEntry entry) 595EventTime = DateTime.UtcNow; 600public ProgressEvent(int index, string name, DateTime startTime, EventKind kind) 608EventTime = DateTime.UtcNow;
Microsoft.ML.Core.Tests (6)
UnitTests\CoreBaseTestClass.cs (2)
124return GetComparerVec<DateTime>(r1, r2, col, size, (x, y) => x.Ticks == y.Ticks); 167return GetComparerOne<DateTime>(r1, r2, col, (x, y) => x.Ticks == y.Ticks);
UnitTests\DataTypes.cs (4)
235var dtToDT = Conversions.DefaultInstance.GetStandardConversion<DateTime, DateTime>( 240DateTime dt = new DateTime(2017, 03, 05); 241DateTime result = default;
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;
Data\DataViewTypeManager.cs (1)
32typeof(VBuffer<>), typeof(Nullable<>), typeof(DateTime), typeof(DateTimeOffset),
DataLoadSave\Binary\Codecs.cs (8)
573private sealed class DateTimeCodec : SimpleCodec<DateTime> 580public override IValueWriter<DateTime> OpenWriter(Stream stream) 585public override IValueReader<DateTime> OpenReader(Stream stream, int items) 590private sealed class Writer : ValueWriterBase<DateTime> 599public override void Write(in DateTime value) 616private sealed class Reader : ValueReaderBase<DateTime> 619private DateTime _value; 636public override void Get(ref DateTime value)
DataLoadSave\Database\DatabaseLoaderCursor.cs (6)
191else if (typeof(TValue) == typeof(DateTime)) 243else if (typeof(TValue) == typeof(VBuffer<DateTime>)) 307private ValueGetter<DateTime> CreateDateTimeGetterDelegate(ColInfo colInfo) 310return (ref DateTime value) => value = DataReader.IsDBNull(columnIndex) ? default : DataReader.GetDateTime(columnIndex); 433private ValueGetter<VBuffer<DateTime>> CreateVBufferDateTimeGetterDelegate(ColInfo colInfo) 435return (ref VBuffer<DateTime> value) =>
DataLoadSave\Database\DbExtensions.cs (1)
33return typeof(DateTime);
DataLoadSave\Text\TextSaver.cs (3)
117ValueMapper<DateTime, StringBuilder> c = MapDateTime; 143protected void MapDateTime(in DateTime src, ref StringBuilder sb) 864internal static void MapDateTime(in DateTime src, ref StringBuilder sb)
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"/>
Utilities\TimerScope.cs (1)
49_ch.Info("{0}\t Time elapsed(s): {1}\n\n", DateTime.UtcNow.ToString("MM/dd/yyyy H:mm:ss tt"), elapsedSeconds);
Utils\ApiUtils.cs (1)
41t == typeof(DateTime) || t == typeof(DateTimeOffset) || t == typeof(TimeSpan) ||
Microsoft.ML.DataView (2)
DataViewType.cs (2)
362/// The standard date time type. This has representation type of <see cref="DateTime"/>. 382: base(typeof(DateTime))
Microsoft.ML.Fairlearn (1)
Metrics\FairlearnMetricCatalog.cs (1)
215else if (column.Type.RawType == typeof(DateTime))
Microsoft.ML.FastTree (1)
TreeEnsemble\InternalTreeEnsemble.cs (1)
201sb.AppendFormat("\n\n[Comments]\nC:0=Regression Tree Ensemble\nC:1=Generated using FastTree\nC:2=Created on {0}\n", DateTime.UtcNow.ToString("MM/dd/yyyy H:mm:ss tt"));
Microsoft.ML.GenAI.Core (2)
CausalLMPipelineChatClient.cs (2)
50CreatedAt = DateTime.UtcNow, 75CreatedAt = DateTime.UtcNow,
Microsoft.ML.IntegrationTests (2)
Datasets\TypeTestData.cs (2)
62public DateTime Dt { get; set; } 143Dt = DateTime.FromOADate(rng.Next(657435, 2958465)),
Microsoft.ML.Maml (1)
MAML.cs (1)
140string.Format(CultureInfo.InvariantCulture, "Error_{0:yyyyMMdd_HHmmss}_{1}.log", DateTime.UtcNow, Guid.NewGuid()));
Microsoft.ML.ResultProcessor (1)
ResultProcessor.cs (1)
591ExecutionDate = DateTime.UtcNow.ToString()
Microsoft.ML.Samples (21)
Dynamic\DataOperations\DataViewEnumerable.cs (3)
69public DateTime Date { get; set; } 76public DateTime Date { get; set; } 90var date = new DateTime(2012, 1, 1);
Dynamic\DataOperations\FilterRowsByColumn.cs (2)
76public DateTime Date { get; set; } 90var date = new DateTime(2012, 1, 1);
Dynamic\DataOperations\ShuffleRows.cs (2)
64public DateTime Date { get; set; } 78var date = new DateTime(2012, 1, 1);
Dynamic\DataOperations\SkipRows.cs (2)
68public DateTime Date { get; set; } 82var date = new DateTime(2012, 1, 1);
Dynamic\DataOperations\TakeRows.cs (2)
69public DateTime Date { get; set; } 83var date = new DateTime(2012, 1, 1);
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;
Dynamic\Transforms\TimeSeries\LocalizeRootCause.cs (2)
19DateTime timestamp = GetTimestamp(); 109private static DateTime GetTimestamp()
Dynamic\Transforms\TimeSeries\LocalizeRootCauseMultidimension.cs (2)
20DateTime timestamp = GetTimestamp(); 135private static DateTime GetTimestamp()
Microsoft.ML.StandardTrainers (3)
Standard\Online\OnlineLinear.cs (3)
134ch.Trace("{0} Initializing {1} on {2} features", DateTime.UtcNow, parent.Name, numFeatures); 208ch.Trace("{0} Starting training iteration {1}", DateTime.UtcNow, Iteration); 219DateTime.UtcNow, Iteration, NumIterExamples);
Microsoft.ML.TestFramework (4)
DataPipe\TestDataPipeBase.cs (4)
922else if (rawType == typeof(DateTime)) 923return GetComparerOne<DateTime>(r1, r2, col, (x, y) => x == y); 973else if (itemType == typeof(DateTime)) 974return GetComparerVec<DateTime>(r1, r2, col, size, (x, y) => x == y);
Microsoft.ML.Tests (9)
CollectionsDataViewTest.cs (2)
456private DateTime _dateTime = DateTime.Now;
DatabaseLoaderTests.cs (2)
261var datetimes = data.GetColumn<DateTime>("datetime").ToArray(); 266datetimes[0].Should().Be(DateTime.MinValue);
Scenarios\Api\TestApi.cs (1)
410public DateTime DateTimeStrat { get; set; }
TextLoaderTests.cs (4)
1470DateTime baselineDate = default; 1482DateTime testDate = default; 1501var delegateBaselineDate = cursorBaseline.GetGetter<DateTime>(baselineDV.Schema["date"]); 1513var delegateTestDate = cursorTest.GetGetter<DateTime>(testDV.Schema["date"]);
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)
TimeSeriesDirectApi.cs (1)
1172private static DateTime GetRootCauseTimestamp()
Microsoft.ML.Transforms (2)
CategoricalCatalog.cs (2)
29/// will be used as source. This column's data type can be scalar or vector of numeric, text, boolean, <see cref="System.DateTime"/> or <see cref="System.DateTimeOffset"/>,</param> 124/// This column's data type can be scalar or vector of numeric, text, boolean, <see cref="System.DateTime"/> or <see cref="System.DateTimeOffset"/>.</param>
Microsoft.Net.Http.Headers.Tests (1)
HeaderUtilitiesTest.cs (1)
42for (var i = 1; i < DateTime.DaysInMonth(date.Year, date.Month); i++)
Microsoft.VisualBasic.Core (45)
Microsoft\VisualBasic\CompilerServices\Conversions.vb (5)
1966Dim ParsedDate As DateTime 2008If TypeOf Value Is DateTime Then 2009Return CDate(DirectCast(Value, DateTime)) 2032Friend Shared Function TryParseDate(ByVal Value As String, ByRef Result As DateTime) As Boolean 2037Return DateTime.TryParse(ToHalfwidthNumbers(Value, Culture), Culture, ParseStyle, Result)
Microsoft\VisualBasic\CompilerServices\ObjectType.vb (3)
267Return GetType(DateTime) 724Private Shared Function ObjTstDateTime(ByVal var1 As DateTime, ByVal var2 As DateTime) As Integer
Microsoft\VisualBasic\CompilerServices\Utils.vb (2)
22Friend Shared Sub SetTime(ByVal dtTime As DateTime) 46Friend Shared Sub SetDate(ByVal vDate As DateTime)
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\FileSystem.vb (1)
299Public Function FileDateTime(ByVal PathName As String) As DateTime
Microsoft\VisualBasic\Information.vb (1)
82Dim convertedDate As DateTime
Microsoft\VisualBasic\Strings.vb (2)
587Public Function Len(ByVal Expression As DateTime) As Integer 1392Public Function FormatDateTime(ByVal Expression As DateTime, Optional ByVal NamedFormat As DateFormat = DateFormat.GeneralDate) As String
Microsoft.VisualBasic.Tests (9)
Microsoft\VisualBasic\Devices\ClockTests.cs (8)
13var before = clock.LocalTime; 16var now = DateTime.Now; 19var after = clock.LocalTime; 30var before = clock.GmtTime; 33var now = DateTime.UtcNow; 36var after = clock.GmtTime;
Microsoft\VisualBasic\MyServices\FileSystemProxyTests.cs (1)
378Assert.True(info.CreationTime > DateTime.MinValue);
Microsoft.VisualStudio.LanguageServices (19)
EditAndContinue\EditAndContinueFeedbackDiagnosticFileProvider.cs (1)
43private readonly DateTime _vsProcessStartTime;
ProjectSystem\MetadataReferences\VisualStudioMetadataReferenceManager.cs (4)
59private readonly Dictionary<string, (DateTime lastWriteTime, AssemblyMetadata metadata)> _metadataCache = new(StringComparer.OrdinalIgnoreCase); 102private bool TryGetMetadata(string filePath, DateTime lastWriteTime, [NotNullWhen(true)] out AssemblyMetadata? metadata) 118public IReadOnlyList<TemporaryStorageStreamHandle>? GetStorageHandles(string fullPath, DateTime snapshotTimestamp) 157internal Metadata GetMetadata(string fullPath, DateTime snapshotTimestamp)
ProjectSystem\MetadataReferences\VisualStudioPortableExecutableReference.cs (4)
34private readonly Lazy<DateTime> _timestamp; 50_timestamp = new Lazy<DateTime>(() => 66return DateTime.MinValue; 76var timestamp = _timestamp.Value;
src\Compilers\Core\Portable\FileKey.cs (2)
21public readonly DateTime Timestamp; 28public FileKey(string fullPath, DateTime timestamp)
Telemetry\FileLogger.cs (2)
50=> DateTime.Now.ToString(CultureInfo.InvariantCulture).Replace(' ', '_').Replace('/', '_').Replace(':', '_') + ".log"; 101buffer.AppendLine($"{DateTime.Now} ({functionId}) : {message}");
Utilities\TimeSlice.cs (3)
11private readonly DateTime _end; 14=> _end = DateTime.UtcNow + duration; 20return DateTime.UtcNow > _end;
Watson\FaultReporter.cs (3)
315var now = DateTime.UtcNow; 330var lastWrite = File.GetLastWriteTimeUtc(path);
MinimalFormSample (4)
Program.cs (4)
58var dueDate = DateTime.Parse(form["dueDate"].ToString(), CultureInfo.InvariantCulture); 66class Todo(string name, bool isCompleted, DateTime dueDate) 70public DateTime DueDate { get; set; } = dueDate;
MinimalSample (1)
Program.cs (1)
21Date and Time: {DateTime.Now}
MSBuild (31)
CachingFileSystemWrapper.cs (3)
17private readonly ConcurrentDictionary<string, DateTime> _lastWriteTimeCache = new ConcurrentDictionary<string, DateTime>(); 34public DateTime GetLastWriteTimeUtc(string path)
CommunicationsUtilities.cs (2)
237private static long s_lastLoggedTicks = DateTime.UtcNow.Ticks; 845long now = DateTime.UtcNow.Ticks;
ExceptionHandling.cs (2)
368writer.WriteLine(DateTime.Now.ToString("G", CultureInfo.CurrentCulture)); 387internal static string ReadAnyExceptionFromFile(DateTime fromTimeUtc)
FileUtilities.cs (1)
172DateTime lastModifiedTime;
IFileSystem.cs (1)
41DateTime GetLastWriteTimeUtc(string path);
LogMessagePacketBase.cs (2)
937DateTime timestamp = responseFileUsedEventArgs.RawTimestamp; 1305DateTime timestamp = default;
ManagedFileSystem.cs (1)
134public virtual DateTime GetLastWriteTimeUtc(string path)
MSBuildOnWindowsFileSystem.cs (1)
66public DateTime GetLastWriteTimeUtc(string path)
NodeEndpointOutOfProcBase.cs (4)
356DateTime originalWaitStartTime = DateTime.UtcNow; 361DateTime restartWaitTime = DateTime.UtcNow;
PerformanceLogEventListener.cs (1)
145s_builder.Append($"[{DateTime.UtcNow:o}] Event={eventData.EventSource.Name}/{eventData.EventName} ProcessID={_processIDStr} ThreadID={Environment.CurrentManagedThreadId}\t ");
TaskParameter.cs (3)
552DateTime dateTimeParam = _wrappedParameter is DateTime wrappedDateTime ? wrappedDateTime : default; 632TypeCode.DateTime => typeof(DateTime),
WindowsFileSystem.cs (4)
81public override DateTime GetLastWriteTimeUtc(string path) 83var fileLastWriteTime = NativeMethodsShared.GetLastWriteFileUtcTime(path); 85if (fileLastWriteTime != DateTime.MinValue) 91NativeMethodsShared.GetLastWriteDirectoryUtcTime(path, out var directoryLastWriteTime);
XMake.cs (6)
250KnownTelemetry.PartialBuildTelemetry = new BuildTelemetry { StartAt = DateTime.UtcNow }; 659KnownTelemetry.PartialBuildTelemetry ??= new BuildTelemetry { StartAt = DateTime.UtcNow }; 817DateTime t1 = DateTime.Now; 911DateTime t2 = DateTime.Now;
MSBuildTaskHost (45)
BinaryReaderExtensions.cs (2)
60public static DateTime ReadTimestamp(this BinaryReader reader) 64var timestamp = new DateTime(timestampTicks, kind);
BinaryTranslator.cs (8)
396public void Translate(ref DateTime value) 767public void TranslateDictionary(ref Dictionary<string, DateTime> dictionary, StringComparer comparer) 777DateTime val = DateTime.MinValue; 1194public void Translate(ref DateTime value) 1568public void TranslateDictionary(ref Dictionary<string, DateTime> dictionary, StringComparer comparer) 1577foreach (KeyValuePair<string, DateTime> kvp in dictionary) 1580DateTime val = kvp.Value;
BinaryWriterExtensions.cs (1)
49public static void WriteTimestamp(this BinaryWriter writer, DateTime timestamp)
CommunicationsUtilities.cs (2)
237private static long s_lastLoggedTicks = DateTime.UtcNow.Ticks; 845long now = DateTime.UtcNow.Ticks;
ExceptionHandling.cs (2)
368writer.WriteLine(DateTime.Now.ToString("G", CultureInfo.CurrentCulture)); 387internal static string ReadAnyExceptionFromFile(DateTime fromTimeUtc)
FileSystem\MSBuildTaskHostFileSystem.cs (1)
31public DateTime GetLastWriteTimeUtc(string path)
FileUtilities.cs (1)
172DateTime lastModifiedTime;
IFileSystem.cs (1)
41DateTime GetLastWriteTimeUtc(string path);
ITranslator.cs (2)
217void Translate(ref DateTime value); 325void TranslateDictionary(ref Dictionary<string, DateTime> dictionary, StringComparer comparer);
NativeMethods.cs (18)
63internal static DateTime MinFileDate { get; } = DateTime.FromFileTimeUtc(0); 983internal static bool GetLastWriteDirectoryUtcTime(string fullPath, out DateTime fileModifiedTimeUtc) 989fileModifiedTimeUtc = DateTime.MinValue; 998fileModifiedTimeUtc = DateTime.FromFileTimeUtc(dt); 1017fileModifiedTimeUtc = DateTime.MinValue; 1153internal static DateTime GetLastWriteFileUtcTime(string fullPath) 1182DateTime LastWriteFileUtcTime(string path) 1184DateTime fileModifiedTime = DateTime.MinValue; 1199fileModifiedTime = DateTime.FromFileTimeUtc(dt); 1214: DateTime.MinValue; 1246private static DateTime GetContentLastWriteFileUtcTime(string fullPath) 1248DateTime fileModifiedTime = DateTime.MinValue; 1260DateTime.FromFileTimeUtc(fileTime); 1327DateTime myStartTime = thisProcess.StartTime; 1445internal static List<KeyValuePair<int, SafeProcessHandle>> GetChildProcessIds(int parentProcessId, DateTime parentStartTime)
NodeEndpointOutOfProcBase.cs (4)
356DateTime originalWaitStartTime = DateTime.UtcNow; 361DateTime restartWaitTime = DateTime.UtcNow;
TaskParameter.cs (3)
552DateTime dateTimeParam = _wrappedParameter is DateTime wrappedDateTime ? wrappedDateTime : default; 632TypeCode.DateTime => typeof(DateTime),
mscorlib (1)
src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
141[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.DateTime))]
Mvc.Api.Analyzers.Test (1)
SymbolApiConventionMatcherTest.cs (1)
269[InlineData(typeof(string), typeof(DateTime))]
MvcFormSample (2)
Models\Todo.cs (2)
9public DateTime DueDate { get; set; } = DateTime.Now.Add(TimeSpan.FromDays(1));
MyFrontend (8)
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)
netstandard.cs (1)
611[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.DateTime))]
OrderProcessor (1)
OrderProcessingWorker.cs (1)
55_logger.LogInformation($"Processing Order at: {DateTime.UtcNow}");
OutputCachingSample (2)
Gravatar.cs (1)
15await context.Response.WriteAsync($"<pre>Generated at {DateTime.Now:hh:mm:ss.ff}</pre>");
Startup.cs (1)
46app.MapGet("/vary", Gravatar.WriteGravatar).CacheOutput(c => c.VaryByValue((context) => new KeyValuePair<string, string>("time", (DateTime.Now.Second % 2).ToString(CultureInfo.InvariantCulture))));
PresentationBuildTasks (13)
MS\Internal\MarkupCompiler\VersionHelper.cs (3)
181public static Version? GenerateVersionFromPatternAndCurrentTime(DateTime time, Version pattern) 191if (time == default(DateTime)) 193time = DateTime.Now;
MS\Internal\Tasks\IncrementalCompileAnalyzer.cs (4)
311private DateTime LastCompileTime 315DateTime nonSet = new DateTime(0); 578DateTime dtFile; 610private DateTime _lastCompileTime = new DateTime(0);
MS\Internal\Tasks\TaskFileService.cs (4)
49DateTime GetLastChangeTime(string srcFile); 211public DateTime GetLastChangeTime(string srcFile) 213DateTime lastChangeDT; 223lastChangeDT = DateTime.FromFileTime(fileTime);
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\KnownTypes.cs (1)
5508case KnownElements.DateTime: t = typeof(DateTime); break;
src\Microsoft.DotNet.Wpf\src\Shared\System\Windows\Markup\TypeConverterHelper.cs (1)
228else if (typeof(DateTime).IsAssignableFrom(type))
PresentationCore (114)
MS\Internal\AppModel\SiteOfOriginContainer.cs (4)
46DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 181DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " +
MS\Internal\AppModel\SiteOfOriginPart.cs (18)
50DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 62DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 90DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 106DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 120DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 133DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 159DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 183DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 193DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " +
MS\Internal\FontCache\FontSource.cs (2)
144public DateTime GetLastWriteTimeUtc() 152return DateTime.MaxValue;
MS\Internal\Ink\InkSerializedFormat\CustomAttributeSerializer.cs (12)
163DateTime [] data = (DateTime[])value; 257DateTime data = (DateTime)value; 630DateTime[] val = new DateTime[count]; 633val[i] = DateTime.FromOADate(br.ReadDouble()); 674return DateTime.FromOADate(br.ReadDouble()); 928DateTime[] data = (DateTime[])value; 935DateTime data = (DateTime)value;
MS\Internal\Ink\InkSerializedFormat\SerializationHelper.cs (2)
290else if (typeof(DateTime) == type) 294else if (typeof(DateTime[]) == type)
System\IO\Packaging\PackWebRequest.cs (6)
81DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 153DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 169DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " +
System\IO\Packaging\PackWebRequestFactory.cs (6)
65DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 104DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 117DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " +
System\IO\Packaging\PackWebResponse.cs (44)
67DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 90DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 100DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 134DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 173DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 195DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 485DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 506DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 519DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 542DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 601DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 618DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 627DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 645DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 658DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 669DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 769DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 791DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 806DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 835DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 877DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + 892DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " +
System\Windows\InterOp\HwndTarget.cs (9)
193private DateTime _lastWakeOrUnlockEvent; 249_lastWakeOrUnlockEvent = DateTime.MinValue; 984TimeSpan delta = DateTime.Now - _lastWakeOrUnlockEvent; 1233_lastWakeOrUnlockEvent = DateTime.MinValue; 1249_lastWakeOrUnlockEvent = DateTime.Now; 1271_lastWakeOrUnlockEvent = DateTime.MinValue; 1286_lastWakeOrUnlockEvent = DateTime.Now; 1321_lastWakeOrUnlockEvent = DateTime.Now; 1328_lastWakeOrUnlockEvent = DateTime.MinValue;
System\Windows\LayoutManager.cs (5)
264DateTime loopStartTime = new DateTime(0); 274loopStartTime = DateTime.UtcNow; 278TimeSpan loopDuration = (DateTime.UtcNow - loopStartTime); 342loopStartTime = DateTime.UtcNow; 346TimeSpan loopDuration = (DateTime.UtcNow - loopStartTime);
System\Windows\Media\Animation\TimeManager.cs (1)
446return TimeSpan.FromTicks(DateTime.Now.Ticks);
System\Windows\Media\Imaging\BitmapMetadata.cs (3)
1314DateTime dateTime = DateTime.FromFileTime( (((long)time.dwHighDateTime) << 32) + (uint)time.dwLowDateTime ); 1321DateTime dt = System.Convert.ToDateTime(value, CultureInfo.InvariantCulture);
System\Windows\Nrbf\SerializationRecordExtensions.cs (2)
155SZArrayRecord<DateTime> ar => ar.GetArray().CreateTrimmedList(size), 242SZArrayRecord<DateTime> ar => ar.GetArray(),
PresentationCore.Tests (2)
System\Windows\DurationConverter.Tests.cs (1)
80[InlineData(typeof(DateTime))]
System\Windows\Media\Animation\KeySplineConverter.Tests.cs (1)
299yield return new object[] { new KeySpline(0.33, 0.66, 0.66, 0.33), typeof(DateTime), CultureInfo.InvariantCulture };
PresentationFramework (397)
MS\Internal\Data\DataBindEngine.cs (2)
521long startTime = DateTime.Now.Ticks; // unit = 10^-7 sec 547if (DateTime.Now.Ticks - startTime > CrossThreadThreshold)
MS\Internal\Data\DefaultValueConverter.cs (2)
474if (sourceType == typeof(DateTime)) 476if (targetType == typeof(DateTime))
MS\Internal\Documents\FlowDocumentPaginator.cs (5)
756DateTime dtStart = DateTime.Now; 757DateTime dtStop; 796dtStop = DateTime.Now; 810dtStop = DateTime.Now;
MS\Internal\Documents\TextBoxView.cs (4)
2200DateTime stopTime; 2209stopTime = DateTime.MaxValue; 2213stopTime = DateTime.Now.AddMilliseconds(_maxMeasureTimeMs); 2239while (!endOfParagraph && DateTime.Now < stopTime);
MS\Internal\IO\Packaging\indexingfiltermarshaler.cs (2)
195else if (obj is DateTime) 201long longFileTime = ((DateTime)obj).ToFileTime();
MS\Internal\PtsHost\BackgroundFormatInfo.cs (5)
78_backgroundFormatStopTime = DateTime.UtcNow.AddMilliseconds(_stopTimeDelta); 147internal DateTime BackgroundFormatStopTime { get { return _backgroundFormatStopTime; } } 231private DateTime _backgroundFormatStopTime; 258private DateTime _throttleTimeout = DateTime.UtcNow;
MS\Internal\PtsHost\TextParagraph.cs (1)
285if (backgroundFormatInfo.BackgroundFormatStopTime > DateTime.UtcNow)
MS\Internal\Utility\TraceLog.cs (1)
37string s = $"{DateTime.Now.Ticks.ToString(CultureInfo.InvariantCulture)} {String.Format(CultureInfo.InvariantCulture, message, args)}";
System\Windows\Annotations\Annotation.cs (13)
74_created = DateTime.MinValue; 75_modified = DateTime.MinValue; 102_created = DateTime.Now; 122public Annotation(XmlQualifiedName annotationType, Guid id, DateTime creationTime, DateTime lastModificationTime) 433public DateTime CreationTime 445public DateTime LastModificationTime 674if (_created.Equals(DateTime.MinValue)) 678if (_modified.Equals(DateTime.MinValue)) 859_modified = DateTime.Now; 879_modified = DateTime.Now; 923private DateTime _created; 928private DateTime _modified;
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\Automation\Peers\DateTimeAutomationPeer.cs (2)
22internal DateTimeAutomationPeer(DateTime date, Calendar owningCalendar, CalendarMode buttonMode) 54internal 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\CalendarBlackoutDatesCollection.cs (19)
40this.Add(new CalendarDateRange(DateTime.MinValue, DateTime.Today.AddDays(-1))); 48public bool Contains(DateTime date) 59public bool Contains(DateTime start, DateTime end) 61DateTime rangeStart, rangeEnd; 64if (DateTime.Compare(end, start) > -1) 77if (DateTime.Compare(this[i].Start, rangeStart) == 0 && DateTime.Compare(this[i].End, rangeEnd) == 0) 110internal DateTime? GetNonBlackoutDate(DateTime? requestedDate, int dayInterval) 114DateTime? currentDate = requestedDate; 122if ((range = GetContainingDateRange((DateTime)currentDate)) == null) 140} while (currentDate != null && ((range = GetContainingDateRange((DateTime)currentDate)) != null)); 322private bool IsValid(DateTime start, DateTime end) 326DateTime? day = child as DateTime?; 347private CalendarDateRange GetContainingDateRange(DateTime date)
System\Windows\Controls\CalendarDateChangedEventArgs.cs (4)
11internal CalendarDateChangedEventArgs(DateTime? removedDate, DateTime? addedDate) 20public DateTime? AddedDate 29public DateTime? RemovedDate
System\Windows\Controls\CalendarDateRange.cs (16)
15private DateTime _end; 16private DateTime _start; 23this(DateTime.MinValue, DateTime.MaxValue) 31public CalendarDateRange(DateTime day) : 41public CalendarDateRange(DateTime start, DateTime end) 58public DateTime End 67DateTime newEnd = CoerceEnd(_start, value); 80public DateTime Start 91DateTime oldEnd = End; 92DateTime newEnd = CoerceEnd(value, _end); 156private static DateTime CoerceEnd(DateTime start, DateTime end) 158return (DateTime.Compare(start, end) <= 0) ? end : start;
System\Windows\Controls\CalendarDateRangeChangingEventArgs.cs (6)
11public CalendarDateRangeChangingEventArgs(DateTime start, DateTime end) 17public DateTime Start 22public DateTime End 27private DateTime _start; 28private DateTime _end;
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;
System\Windows\Controls\VirtualizingStackPanel.cs (3)
12334"Time:", DateTime.Now); 12378AddTrace(null, ScrollTraceOp.ID, _nullInfo, "Inactive at", DateTime.Now); 12394AddTrace(null, ScrollTraceOp.ID, _nullInfo, "Reactivate at", DateTime.Now);
System\Windows\Data\CollectionView.cs (2)
1838long beginTime = DateTime.Now.Ticks; 1846mustDeferProcessing = DateTime.Now.Ticks - beginTime > DataBindEngine.CrossThreadThreshold;
System\Windows\Documents\Speller.cs (2)
543timeLimit = DateTime.Now.Ticks + MaxIdleTimeSliceNs; 1852long nowTicks = DateTime.Now.Ticks;
System\Windows\Documents\Tracing\SpellerCOMActionTraceLogger.cs (2)
168_beginTicks = DateTime.Now.Ticks; 239UpdateRunningAverageAndLogDebugInfo(endTicks: DateTime.Now.Ticks);
System\Windows\Markup\Baml2006\Baml2006KnownTypes.cs (1)
216case 123: t = () => typeof(DateTime); break;
System\Windows\Markup\Baml2006\WpfGeneratedKnownTypes.cs (1)
3386typeof(System.DateTime),
System\Windows\Markup\KnownTypes.cs (1)
5670case KnownElements.DateTime: t = typeof(System.DateTime); break;
PresentationFramework.Tests (1)
System\Windows\Controls\VirtualizationCacheLengthConverter.Tests.cs (1)
288yield return new object[] { new VirtualizationCacheLength(0.66, 0.33), typeof(DateTime), CultureInfo.InvariantCulture };
PresentationUI (55)
MS\Internal\Documents\Application\DocumentProperties.cs (6)
124internal DateTime? FileCreated 128DateTime? fileCreated = null; 141internal DateTime? FileModified 145DateTime? fileModified = null; 158internal DateTime? FileAccessed 162DateTime? fileAccessed = null;
MS\Internal\Documents\Application\DocumentPropertiesDialog.cs (1)
153private void SetTextProperty(Control control, DateTime? date)
MS\Internal\Documents\Application\SuppressedPackageProperties.cs (3)
177public override Nullable<DateTime> LastPrinted 194public override Nullable<DateTime> Created 211public override Nullable<DateTime> Modified
MS\Internal\Documents\DigitalSignature.cs (2)
81internal DateTime? SignedOn 212private DateTime? _signedOn;
MS\Internal\Documents\DocumentSignatureManager.cs (2)
774internal void OnAddRequestSignature(SignatureResources sigResources, DateTime dateTime) 911collection = collection.Find(X509FindType.FindByTimeValid, DateTime.Now, true /*validOnly*/);
MS\Internal\Documents\RequestedSignatureDialog.cs (2)
29_dateTimePicker.MinDate = DateTime.Now; 30_dateTimePicker.Value = DateTime.Now.AddDays(10);
MS\Internal\Documents\RightsManagementLicense.cs (6)
76if ((ValidFrom.CompareTo(DateTime.UtcNow) > 0) || 77(ValidUntil.CompareTo(DateTime.UtcNow) < 0)) 90internal DateTime ValidFrom 101internal DateTime ValidUntil 158private DateTime _validFrom; 159private DateTime _validUntil;
MS\Internal\Documents\RightsManagementManager.cs (1)
1115if (DateTime.Compare(
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; 1315private ContentGrant CreateGrant(RightsManagementUser user, ContentRight right, DateTime validFrom, DateTime validUntil)
MS\Internal\Documents\RMPermissions.cs (3)
141private static string GetUtcDateAsString(DateTime? date) 144date.Value.Equals(DateTime.MaxValue)) 150DateTime localDate = date.Value.ToLocalTime();
MS\Internal\Documents\RMPublishingDialog.cs (11)
46datePickerValidUntil.MinDate = DateTime.Today.AddDays(1); 47datePickerValidUntil.Value = DateTime.Today.AddDays(1); 86DateTime validUntil = DateTime.MaxValue; 90if (license.ValidUntil > DateTime.UtcNow && 97DateTime localValidUntil = DateTimePicker.MaximumDateTime; 100if (validUntil < DateTime.MaxValue) 164internal DateTime? ValidUntil 252rmLicense.ValidFrom = DateTime.MinValue; 253rmLicense.ValidUntil = DateTime.MaxValue; 269rmLicense.ValidFrom = DateTime.UtcNow;
MS\Internal\Documents\SignatureResourceHelper.cs (2)
318private static string GetFormattedDate(Nullable<DateTime> date) 326((DateTime)date).ToShortDateString());
QueueSharing (1)
Program.cs (1)
67await context.Response.WriteAsync("Hello world from " + context.Request.Host + " at " + DateTime.Now);
RazorPagesWebSite (2)
ModelHandlerTestModel.cs (2)
41DateTime dateTime = default(DateTime))
ReachFramework (8)
AlphaFlattener\Utility.cs (3)
26 private static DateTime s_startTime; 31 s_startTime = DateTime.Now; 36 TimeSpan elapsed = DateTime.Now - s_startTime;
packaging\XpsDigitalSignature.cs (1)
189DateTime
Packaging\XPSSignatureDefinition.cs (4)
201DateTime? 308private DateTime? _signBy; 379writer.WriteString(((DateTime)SignBy).ToUniversalTime().ToString("s", DateTimeFormatInfo.InvariantInfo) + "Z"); 552SignBy = DateTime.Parse(ReadData(reader), System.Globalization.CultureInfo.InvariantCulture);
Redis.ApiService (3)
Program.cs (3)
22return await connection.GetDatabase().StringSetAsync("Key", $"{DateTime.Now}"); 38return await connection.GetDatabase().StringSetAsync("Key", $"{DateTime.Now}"); 54return await connection.GetDatabase().StringSetAsync("Key", $"{DateTime.Now}");
ResponseCachingSample (1)
Startup.cs (1)
27await context.Response.WriteAsync("Hello World! " + DateTime.UtcNow);
Roslyn.Test.PdbUtilities (1)
Shared\DateTimeUtilities.cs (1)
16internal static DateTime ToDateTime(double raw)
Roslyn.Test.Performance.Utilities (2)
Logger.cs (2)
64Console.WriteLine(DateTime.Now + " : " + v); 65_buffer.AppendLine(DateTime.Now + " : " + v);
Roslyn.VisualStudio.Next.UnitTests (2)
Services\SolutionServiceTests.cs (2)
522var frozenSolution1 = solution.WithFrozenSourceGeneratedDocument(documentIdentity, DateTime.Now, frozenText1).Project.Solution; 531var frozenSolution2 = solution.WithFrozenSourceGeneratedDocument(documentIdentity, DateTime.Now, frozenText2).Project.Solution;
RunTests (8)
ProcessTestExecutor.cs (3)
136var start = DateTime.UtcNow; 149var span = DateTime.UtcNow - start;
Program.cs (3)
141var start = DateTime.Now; 152var elapsed = DateTime.Now - start;
TestHistoryManager.cs (2)
175var minTime = build.QueueTime!.Value; 176var maxTime = build.FinishTime!.Value;
Sample (10)
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))
Endpoints\MapVersionedEndpoints.cs (2)
15v1.MapGet("/todos/{id}", (int id) => new TodoWithDueDate(1, "Test todo", false, DateTime.Now.AddDays(1), DateTime.Now))
Endpoints\MapXmlEndpoints.cs (1)
38public DateTime DateTimeType { get; set; }
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)
ScenarioTestHelpers.cs (1)
230int seed = DateTime.Now.Millisecond;
ScenarioTestTypes.cs (8)
363private DateTime _dateTimeValue; 402public DateTime DateTimeValue 1076private DateTime _readStartedTime; 1120if (_readStartedTime == DateTime.MinValue) 1122_readStartedTime = DateTime.Now; 1124if (DateTime.Now - _readStartedTime >= StreamDuration) 1138int seed = DateTime.Now.Millisecond; 1189Name = "ClientReceiver_" + DateTime.Now;
ServiceInterfaces.cs (6)
738DateTime ReturnInputDateTime(DateTime dt); 767DateTime ReturnInputDateTime(DateTime dt); 796DateTime ReturnInputDateTime(DateTime dt);
Security.TransportSecurity.IntegrationTests (2)
Tcp\ClientCredentialTypeTests.OSX.cs (2)
124DateTime now = DateTime.Now;
SecurityWebSite (1)
BearerAuth.cs (1)
36var token = new JwtSecurityToken(Issuer, Audience, claims, expires: DateTime.Now.AddMinutes(30), signingCredentials: Credentials);
SelfHostServer (1)
Startup.cs (1)
31await context.Response.WriteAsync("Hello world from " + context.Request.Host + " at " + DateTime.Now);
ServiceBusWorker (1)
Producer.cs (1)
19await sender.SendMessageAsync(new ServiceBusMessage($"Hello, World! It's {DateTime.Now} here."), cancellationToken);
SessionSample (1)
Startup.cs (1)
65await context.Response.WriteAsync(DateTime.Now + "<br>");
Shared (1)
JsonSchemaExporter\JsonSchemaExporter.cs (1)
606[typeof(DateTime)] = _ => new JsonSchema { Type = JsonSchemaType.String, Format = "date-time" },
Shared.Tests (4)
JsonSchemaExporter\TestTypes.cs (4)
82yield return new TestData<DateTime>( 84AdditionalValues: [DateTime.MinValue, DateTime.MaxValue], 1223[JsonSerializable(typeof(DateTime))]
SignalR.Client.FunctionalTestApp (2)
ComplexObject.cs (1)
12public DateTime DateTime { get; set; }
Startup.cs (1)
297var token = new JwtSecurityToken("SignalRTestServer", "SignalRTests", claims, expires: DateTime.Now.AddSeconds(5), signingCredentials: credentials);
Sockets.BindTests (1)
SocketTransportOptionsTests.cs (1)
94new UnixDomainSocketEndPoint($"/tmp/{DateTime.UtcNow:yyyyMMddTHHmmss.fff}.sock")
Sockets.FunctionalTests (8)
src\Servers\Kestrel\test\FunctionalTests\MaxRequestBufferSizeTests.cs (8)
131var lastBytesWritten = DateTime.MaxValue; 152lastBytesWritten = DateTime.Now; 181while ((DateTime.Now - lastBytesWritten) < bytesWrittenTimeout || 224var lastBytesWritten = DateTime.MaxValue; 245lastBytesWritten = DateTime.Now; 271while ((DateTime.Now - lastBytesWritten) < bytesWrittenTimeout ||
Stress.ApiService (1)
Program.cs (1)
295DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
Stress.TelemetryService (12)
artifacts\obj\Stress.TelemetryService\Debug\net8.0\opentelemetry\proto\collector\logs\v1\LogsServiceGrpc.cs (2)
143public virtual global::OpenTelemetry.Proto.Collector.Logs.V1.ExportLogsServiceResponse Export(global::OpenTelemetry.Proto.Collector.Logs.V1.ExportLogsServiceRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) 169public virtual grpc::AsyncUnaryCall<global::OpenTelemetry.Proto.Collector.Logs.V1.ExportLogsServiceResponse> ExportAsync(global::OpenTelemetry.Proto.Collector.Logs.V1.ExportLogsServiceRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
artifacts\obj\Stress.TelemetryService\Debug\net8.0\opentelemetry\proto\collector\metrics\v1\MetricsServiceGrpc.cs (2)
143public virtual global::OpenTelemetry.Proto.Collector.Metrics.V1.ExportMetricsServiceResponse Export(global::OpenTelemetry.Proto.Collector.Metrics.V1.ExportMetricsServiceRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) 169public virtual grpc::AsyncUnaryCall<global::OpenTelemetry.Proto.Collector.Metrics.V1.ExportMetricsServiceResponse> ExportAsync(global::OpenTelemetry.Proto.Collector.Metrics.V1.ExportMetricsServiceRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
artifacts\obj\Stress.TelemetryService\Debug\net8.0\opentelemetry\proto\collector\trace\v1\TraceServiceGrpc.cs (2)
143public virtual global::OpenTelemetry.Proto.Collector.Trace.V1.ExportTraceServiceResponse Export(global::OpenTelemetry.Proto.Collector.Trace.V1.ExportTraceServiceRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) 169public virtual grpc::AsyncUnaryCall<global::OpenTelemetry.Proto.Collector.Trace.V1.ExportTraceServiceResponse> ExportAsync(global::OpenTelemetry.Proto.Collector.Trace.V1.ExportTraceServiceRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
TelemetryStresser.cs (6)
60CreateSumMetric("Test-<b>Bold</b>", DateTime.UtcNow, value: value) 68CreateSumMetric("Test-<b>Bold</b>", DateTime.UtcNow, value: value) 93public static Metric CreateSumMetric(string metricName, DateTime startTime, KeyValuePair<string, string>[]? attributes = null, int? value = null) 112private static NumberDataPoint CreateNumberPoint(DateTime startTime, int value, KeyValuePair<string, string>[]? attributes = null) 131public static ulong DateTimeToUnixNanoseconds(DateTime dateTime) 133var unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
System.Collections.Immutable (1)
System\Collections\Frozen\Constants.cs (1)
61typeof(T) == typeof(DateTime) ||
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\ComponentModel\DateTimeOffsetConverter.cs (1)
36/// Converts the given value object to a <see cref='System.DateTime'/>
System\ComponentModel\ReflectTypeDescriptionProvider.cs (1)
173[typeof(DateTime)] = new IntrinsicTypeConverterData((type) => new DateTimeConverter()),
System\Timers\ElapsedEventArgs.cs (2)
15public ElapsedEventArgs(DateTime signalTime) 23public DateTime SignalTime { get; }
System\Timers\Timer.cs (1)
305ElapsedEventArgs elapsedEventArgs = new ElapsedEventArgs(DateTime.Now);
System.Configuration.ConfigurationManager (17)
System\Configuration\DateTimeConfigurationCollection.cs (3)
13public DateTime this[int index] 25public void Add(DateTime dateTime) 30public void Remove(DateTime dateTime)
System\Configuration\DateTimeConfigurationElement.cs (6)
9new ConfigurationProperty("value", typeof(DateTime), DateTime.MinValue, ConfigurationPropertyOptions.IsKey); 13private readonly DateTime _initValue; 19public DateTimeConfigurationElement(DateTime value) 28public DateTime Value 30get { return (DateTime)base[s_propValue]; }
System\Configuration\Internal\FileVersion.cs (4)
10private readonly DateTime _utcCreationTime; 11private readonly DateTime _utcLastWriteTime; 13internal FileVersion(bool exists, long fileSize, DateTime utcCreationTime, DateTime utcLastWriteTime)
System\Configuration\Internal\InternalConfigHost.cs (2)
217: new FileVersion(false, 0, DateTime.MinValue, DateTime.MinValue);
System\Configuration\Internal\WriteFileContext.cs (1)
98DateTime creationTime;
System\Configuration\SettingsPropertyValue.cs (1)
41if (_value != null && !Property.PropertyType.IsPrimitive && !(_value is string) && !(_value is DateTime))
System.Data.Common (102)
System\Data\ColumnTypeConverter.cs (1)
23typeof(DateTime),
System\Data\Common\DataRecordInternal.cs (2)
290public override DateTime GetDateTime(int i) 292return ((DateTime)_values[i]);
System\Data\Common\DataStorage.cs (1)
83typeof(DateTime),
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\Common\DbDataReader.cs (1)
170public abstract DateTime GetDateTime(int ordinal);
System\Data\Common\DbDataRecord.cs (1)
38public abstract DateTime GetDateTime(int i);
System\Data\Common\ObjectStorage.cs (4)
530if (!isNull && (typedStore[storeIndex] is DateTime dt)) 534typedStore[storeIndex] = DateTime.SpecifyKind(dt.ToUniversalTime(), DateTimeKind.Local); 544if (_values[i] is DateTime dt && dt.Kind == DateTimeKind.Local) 546_values[i] = (DateTime.SpecifyKind(dt, DateTimeKind.Utc)).ToLocalTime();
System\Data\Common\SQLConvert.cs (3)
234StorageType.DateTime => (DateTime)value, 462return ((DateTime)value).ToString(formatProvider); 713return XmlConvert.ToString((DateTime)value, XmlDateTimeSerializationMode.RoundtripKind);
System\Data\DataColumn.cs (1)
605if (DataType != typeof(DateTime) && value != DataSetDateTime.UnspecifiedLocal)
System\Data\DataReaderExtensions.cs (1)
64public static DateTime GetDateTime(this DbDataReader reader, string name)
System\Data\DataRelation.cs (1)
654((_parentKey.ColumnsReference[i].DataType == typeof(DateTime)) &&
System\Data\DataTableReader.cs (2)
463public override DateTime GetDateTime(int ordinal) 469return (DateTime)_currentDataRow![ordinal];
System\Data\Filter\BinaryNode.cs (13)
193return DateTime.Compare(Convert.ToDateTime(vLeft, FormatProvider), Convert.ToDateTime(vRight, FormatProvider)); 419if (vLeft is TimeSpan && vRight is DateTime) 421value = (DateTime)vRight + (TimeSpan)vLeft; 423else if (vLeft is DateTime && vRight is TimeSpan) 425value = (DateTime)vLeft + (TimeSpan)vRight; 488value = SqlConvert.ConvertToSqlDateTime((DateTime)rValue.Value + (TimeSpan)vLeft); 493value = SqlConvert.ConvertToSqlDateTime((DateTime)lValue.Value + (TimeSpan)vRight); 609value = (DateTime)vLeft - (TimeSpan)vRight; 614if (vLeft is DateTime) 616value = (DateTime)vLeft - (DateTime)vRight; 627value = SqlConvert.ConvertToSqlDateTime((DateTime)rValue.Value - (TimeSpan)vLeft); 632value = SqlConvert.ConvertToSqlDateTime((DateTime)lValue.Value - (TimeSpan)vRight);
System\Data\Filter\ConstNode.cs (1)
54_val = DateTime.Parse((string)constant, CultureInfo.InvariantCulture);
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\ForeignKeyConstraint.cs (1)
639((_parentKey.ColumnsReference[i].DataType == typeof(DateTime)) && (_parentKey.ColumnsReference[i].DateTimeMode != _childKey.ColumnsReference[i].DateTimeMode) && ((_parentKey.ColumnsReference[i].DateTimeMode & _childKey.ColumnsReference[i].DateTimeMode) != DataSetDateTime.Unspecified)))
System\Data\IDataRecord.cs (1)
33DateTime GetDateTime(int i);
System\Data\Merger.cs (1)
381((dest.DataType == typeof(DateTime)) && (dest.DateTimeMode != src.DateTimeMode) && ((dest.DateTimeMode & src.DateTimeMode) != DataSetDateTime.Unspecified)))
System\Data\SqlDbType.cs (2)
32/// <see cref="System.DateTime"/>. Date and time data ranging in value from January 1, 1753 to December 31, 9999 to an accuracy of 3.33 milliseconds 93/// <see cref="System.DateTime"/>. Date and time data ranging in value from January 1, 1900 to June 6, 2079 to an accuracy of one minute.
System\Data\SQLTypes\SQLDateTime.cs (16)
39private static readonly DateTime s_SQLBaseDate = new DateTime(1900, 1, 1); 56private static readonly TimeSpan s_maxTimeSpan = DateTime.MaxValue.Subtract(s_SQLBaseDate); 82public SqlDateTime(DateTime value) 203private static DateTime ToDateTime(SqlDateTime value) 209internal static DateTime ToDateTime(int daypart, int timepart) 218DateTime result = new DateTime(s_SQLBaseDateTicks + dayticks + timeticks); 252private static SqlDateTime FromDateTime(DateTime value) 261if (value == DateTime.MaxValue) 285public DateTime Value 321public static implicit operator SqlDateTime(DateTime value) 327public static explicit operator DateTime(SqlDateTime x) 337DateTime dateTime = ToDateTime(this); 343DateTime dt; 350dt = DateTime.Parse(s, CultureInfo.InvariantCulture); 355dt = DateTime.ParseExact(s, s_dateTimeFormats, dtfi, x_DateTimeStyle); 643DateTime dt = XmlConvert.ToDateTime(reader.ReadElementString(), XmlDateTimeSerializationMode.RoundtripKind);
System\Data\TypeLimiter.cs (1)
146typeof(DateTime),
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\xmlsaver.cs (2)
235if (type == typeof(DateTime) || type == typeof(SqlDateTime)) 1386if (col.DataType == typeof(DateTime) && col.DateTimeMode != DataSetDateTime.UnspecifiedLocal)
System\Data\XMLSchema.cs (8)
1820new NameType("date", typeof(DateTime) ), /* XSD Apr */ 1821new NameType("dateTime", typeof(DateTime) ), /* XSD Apr */ 1826new NameType("gDay", typeof(DateTime) ), /* XSD Apr */ 1827new NameType("gMonth", typeof(DateTime) ), /* XSD Apr */ 1828new NameType("gMonthDay", typeof(DateTime) ), /* XSD Apr */ 1829new NameType("gYear", typeof(DateTime) ), /* XSD Apr */ 1830new NameType("gYearMonth", typeof(DateTime) ), /* XSD Apr */ 1843new NameType("time", typeof(DateTime) ), /* XSD Apr */
System.Data.Odbc (20)
Common\System\Data\Common\AdapterUtil.Odbc.cs (1)
597return DateTime.UtcNow.ToFileTimeUtc();
Common\System\Data\ProviderBase\DbBuffer.cs (5)
675internal DateTime ReadDate(int offset) 684internal void WriteDate(int offset, DateTime value) 713internal DateTime ReadDateTime(int offset) 718DateTime value = new DateTime( 727internal void WriteDateTime(int offset, DateTime value)
src\libraries\Common\src\System\Data\ProviderBase\DbConnectionInternal.cs (4)
31private DateTime _createTime; // when the connection was created. 236DateTime now = DateTime.UtcNow; 280_createTime = DateTime.UtcNow;
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\Odbc\OdbcDataReader.cs (4)
810public DateTime GetDate(int i) 812return (DateTime)internalGetDate(i); 831public override DateTime GetDateTime(int i) 833return (DateTime)internalGetDateTime(i);
System\Data\Odbc\OdbcUtils.cs (3)
276WriteODBCDateTime(offset, (DateTime)value); 290WriteDate(offset, (DateTime)value); 333internal void WriteODBCDateTime(int offset, DateTime value)
System.Data.OleDb (1)
artifacts\obj\System.Data.OleDb\Debug\net10.0\System.Data.OleDb.notsupported.cs (1)
207public override System.DateTime GetDateTime(int ordinal) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_OleDb); }
System.Diagnostics.DiagnosticSource (34)
System\Diagnostics\Activity.cs (8)
214/// is called, but you can set at any time via <see cref="SetStartTime(DateTime)"/>. 216public DateTime StartTimeUtc { get; private set; } 736public Activity SetStartTime(DateTime startTimeUtc) 756public Activity SetEndTime(DateTime endTimeUtc) 782/// <item>If <see cref="StartTimeUtc"/> was not set previously, sets it to <see cref="DateTime.UtcNow"/>.</item> 788/// <seealso cref="SetStartTime(DateTime)"/> 840/// If end time was not set previously, sets <see cref="Duration"/> as a difference between <see cref="DateTime.UtcNow"/> and <see cref="StartTimeUtc"/> 844/// <seealso cref="SetEndTime(DateTime)"/>
System\Diagnostics\Activity.DateTime.corefx.cs (2)
11internal static DateTime GetUtcNow() 14return DateTime.UtcNow;
System\Diagnostics\DsesActivitySourceListener.cs (2)
168[DynamicDependency(nameof(DateTime.Ticks), typeof(DateTime))]
System\Diagnostics\Metrics\AggregationManager.cs (18)
38private readonly Action<DateTime, DateTime> _beginCollection; 39private readonly Action<DateTime, DateTime> _endCollection; 48private DateTime _startTime; 49private DateTime _intervalStartTime; 50private DateTime _nextIntervalStartTime; 56Action<DateTime, DateTime> beginCollection, 57Action<DateTime, DateTime> endCollection, 168_intervalStartTime = _nextIntervalStartTime = _startTime = DateTime.UtcNow; 217DateTime now = DateTime.UtcNow; 229DateTime minNextInterval = _intervalStartTime.AddSeconds(collectionIntervalSecs); 250DateTime startTime = DateTime.UtcNow; 251DateTime intervalStartTime = startTime;
System\Diagnostics\Metrics\MetricsEventSource.cs (4)
108public void CollectionStart(string sessionId, DateTime intervalStartTime, DateTime intervalEndTime) 118public void CollectionStop(string sessionId, DateTime intervalStartTime, DateTime intervalEndTime)
System.Diagnostics.EventLog (7)
artifacts\obj\System.Diagnostics.EventLog\Debug\net10.0\System.Diagnostics.EventLog.notsupported.cs (7)
117public System.DateTime TimeGenerated { get { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_EventLog); } } 118public System.DateTime TimeWritten { get { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_EventLog); } } 248public System.DateTime? CreationTime { get { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_EventLog); } } 251public System.DateTime? LastAccessTime { get { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_EventLog); } } 252public System.DateTime? LastWriteTime { get { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_EventLog); } } 376public override System.DateTime? TimeCreated { get { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_EventLog); } } 477public abstract System.DateTime? TimeCreated { get; }
System.Diagnostics.Process (16)
System\Diagnostics\Process.cs (4)
56private DateTime? _startTime; 57private DateTime _exitTime; 199public DateTime StartTime 216public DateTime ExitTime
System\Diagnostics\Process.Linux.cs (4)
60internal DateTime StartTimeCore 71internal static DateTime BootTimeToDateTime(TimeSpan timespanAfterBoot) 74DateTime dt = BootTime + timespanAfterBoot; 83private static DateTime BootTime
System\Diagnostics\Process.Unix.cs (1)
239private DateTime ExitTimeCore
System\Diagnostics\ProcessThread.cs (1)
145public DateTime StartTime
System\Diagnostics\ProcessThread.Linux.cs (1)
48private DateTime GetStartTime() => Process.BootTimeToDateTime(Process.TicksToTimeSpan(GetStat().starttime));
System\Diagnostics\ProcessWaitState.Unix.cs (5)
122DateTime exitTime = default; 217private DateTime _exitTime; 226private ProcessWaitState(int processId, bool isChild, bool usesTerminal, DateTime exitTime = default) 258_exitTime = DateTime.Now; 293internal DateTime ExitTime
System.Diagnostics.TextWriterTraceListener (2)
System\Diagnostics\XmlWriterTraceListener.cs (2)
235InternalWrite(eventCache != null ? eventCache.DateTime : DateTime.Now); 416private void InternalWrite(DateTime message)
System.Diagnostics.TraceSource (5)
System\Diagnostics\TraceEventCache.cs (5)
15private DateTime _dateTime = DateTime.MinValue; 18public DateTime DateTime 22if (_dateTime == DateTime.MinValue) 23_dateTime = DateTime.UtcNow;
System.DirectoryServices (8)
artifacts\obj\System.DirectoryServices\Debug\net10.0\System.DirectoryServices.notsupported.cs (8)
1032public System.DateTime LastOriginatingChangeTime { get { throw new System.PlatformNotSupportedException(System.SR.DirectoryServices_PlatformNotSupported); } } 1198public System.DateTime CurrentTime { get { throw new System.PlatformNotSupportedException(System.SR.DirectoryServices_PlatformNotSupported); } } 1556public System.DateTime LastSuccessfulSyncTime { get { throw new System.PlatformNotSupportedException(System.SR.DirectoryServices_PlatformNotSupported); } } 1574public System.DateTime FirstFailureTime { get { throw new System.PlatformNotSupportedException(System.SR.DirectoryServices_PlatformNotSupported); } } 1591public System.DateTime LastAttemptedSync { get { throw new System.PlatformNotSupportedException(System.SR.DirectoryServices_PlatformNotSupported); } } 1592public System.DateTime LastSuccessfulSync { get { throw new System.PlatformNotSupportedException(System.SR.DirectoryServices_PlatformNotSupported); } } 1638public System.DateTime TimeEnqueued { get { throw new System.PlatformNotSupportedException(System.SR.DirectoryServices_PlatformNotSupported); } } 1652public System.DateTime OperationStartTime { get { throw new System.PlatformNotSupportedException(System.SR.DirectoryServices_PlatformNotSupported); } }
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.Drawing.Common.Tests (1)
System\Drawing\ImageAnimator.ManualTests.cs (1)
10public static string OutputFolder { get; } = Path.Join(Environment.CurrentDirectory, "ImageAnimatorManualTests", DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss"));
System.Formats.Nrbf (22)
System\Formats\Nrbf\ArraySinglePrimitiveRecord.cs (4)
81int sizeOfT = typeof(T) == typeof(DateTime) || typeof(T) == typeof(TimeSpan) 108else if (typeof(T) == typeof(TimeSpan) || typeof(T) == typeof(DateTime)) 233if (typeof(T) == typeof(DateTime)) 307else if (typeof(T) == typeof(DateTime))
System\Formats\Nrbf\ClassRecord.cs (3)
93public DateTime GetDateTime(string memberName) => GetMember<DateTime>(memberName); 96/// <para>For primitive types like <see cref="int"/>, <see langword="string"/>, or <see cref="DateTime"/>, returns their value.</para>
System\Formats\Nrbf\ClassWithIdRecord.cs (1)
70MemberPrimitiveTypedRecord<DateTime> => SystemClassWithMembersAndTypesRecord.DecodeDateTime(reader, id),
System\Formats\Nrbf\NrbfDecoder.cs (3)
258PrimitiveType.DateTime => new MemberPrimitiveTypedRecord<DateTime>(Utils.BinaryReaderExtensions.CreateDateTimeFromData(reader.ReadUInt64())), 289PrimitiveType.DateTime => Decode<DateTime>(info, reader), 315PrimitiveType.DateTime => Decode<DateTime>(info, lengths, reader),
System\Formats\Nrbf\PrimitiveTypeRecord.cs (1)
18/// <see cref="DateTime"/>, and <see cref="TimeSpan"/>.
System\Formats\Nrbf\PrimitiveTypeRecordOfT.cs (1)
21/// <see cref="DateTime"/>, and <see cref="TimeSpan"/>.
System\Formats\Nrbf\SystemClassWithMembersAndTypesRecord.cs (2)
104internal static MemberPrimitiveTypedRecord<DateTime> DecodeDateTime(BinaryReader reader, SerializationRecordId id) 109return new MemberPrimitiveTypedRecord<DateTime>(BinaryReaderExtensions.CreateDateTimeFromData(dateData), id);
System\Formats\Nrbf\Utils\BinaryReaderExtensions.cs (6)
154/// Creates a <see cref="DateTime"/> object from raw data with validation. 157internal static DateTime CreateDateTimeFromData(ulong dateData) 172static DateTime CreateFromAmbiguousDst(ulong ticks) 180if (s_baseAmbiguousDstDateTime is not DateTime baseDateTime) 183SerializationInfo si = new(typeof(DateTime), new FormatterConverter()); 211extern static DateTime CallPrivateSerializationConstructor(SerializationInfo si, StreamingContext ct);
System\Formats\Nrbf\Utils\TypeNameHelpers.cs (1)
96else if (typeof(T) == typeof(DateTime))
System.Formats.Tar (3)
System\Formats\Tar\TarHelpers.cs (3)
138new DateTimeOffset((secondsSinceUnixEpoch * TimeSpan.TicksPerSecond) + DateTime.UnixEpoch.Ticks, TimeSpan.Zero); 142new DateTimeOffset((long)(secondsSinceUnixEpoch * TimeSpan.TicksPerSecond) + DateTime.UnixEpoch.Ticks, TimeSpan.Zero); 146((decimal)(dateTimeOffset.UtcDateTime - DateTime.UnixEpoch).Ticks) / TimeSpan.TicksPerSecond;
System.IO.Compression (3)
System\IO\Compression\ZipHelper.cs (3)
20private static readonly DateTime s_invalidDateIndicator = new DateTime(ValidZipDate_YearMin, 1, 1, 0, 0, 0); 49internal static DateTime DosTimeToDateTime(uint dateTime) 88internal static uint DateTimeToDosTime(DateTime dateTime)
System.IO.Compression.ZipFile (1)
System\IO\Compression\ZipFileExtensions.ZipArchive.Create.cs (1)
113DateTime lastWrite = File.GetLastWriteTime(sourceFileName);
System.IO.Packaging (13)
System\IO\Packaging\PackageProperties.cs (3)
137public abstract Nullable<DateTime> LastPrinted 145public abstract Nullable<DateTime> Created 153public abstract Nullable<DateTime> Modified
System\IO\Packaging\PartBasedPackageProperties.cs (10)
213public override Nullable<DateTime> Created 228public override Nullable<DateTime> Modified 261public override Nullable<DateTime> LastPrinted 352private Nullable<DateTime> GetDateTimePropertyValue(PackageXmlEnum propertyName) 358return (Nullable<DateTime>)valueObject; 656private static DateTime GetDateData(XmlReader reader) 659DateTime dateTime; 666dateTime = DateTime.ParseExact(data, s_dateTimeFormats, CultureInfo.InvariantCulture, DateTimeStyles.None); 780if (entry.Value is Nullable<DateTime>) 797_xmlWriter.WriteString(XmlConvert.ToString(((Nullable<DateTime>)entry.Value).Value.ToUniversalTime(), "yyyy-MM-ddTHH:mm:ss.fffffffZ"));
System.Linq.Expressions (9)
System\Dynamic\Utils\TypeUtils.cs (1)
79return typeof(DateTime?);
System\Linq\Expressions\Common\CachedReflectionInfo.cs (2)
59s_DateTime_MinValue ??= typeof(DateTime).GetField(nameof(DateTime.MinValue))!;
System\Linq\Expressions\Interpreter\CallInstruction.Generated.cs (3)
63case TypeCode.DateTime: return FastCreate<DateTime>(target, pi); 107case TypeCode.DateTime: return FastCreate<T0, DateTime>(target, pi); 149case TypeCode.DateTime: return new FuncCallInstruction<T0, T1, DateTime>(target);
System\Linq\Expressions\Interpreter\TypeOperations.cs (1)
362TypeCode.DateTime => s_DateTime ??= new CastInstructionT<DateTime>(),
System\Linq\Expressions\ParameterExpression.cs (1)
35case TypeCode.DateTime: return new PrimitiveParameterExpression<DateTime>(name);
System\Linq\Expressions\Utils.cs (1)
31public static readonly object BoxedDefaultDateTime = default(DateTime);
System.Linq.Parallel (12)
System\Linq\Parallel\Merging\AsynchronousChannelMergeEnumerator.cs (1)
268TraceHelpers.TraceInfo("[timing]: {0}: Completed the merge", DateTime.Now.Ticks);
System\Linq\Parallel\Merging\SynchronousChannelMergeEnumerator.cs (1)
106TraceHelpers.TraceInfo("[timing]: {0}: Completed the merge", DateTime.Now.Ticks);
System\Linq\Parallel\QueryOperators\PartitionedStreamMerger.cs (1)
63TraceHelpers.TraceInfo("[timing]: {0}: finished opening - QueryOperator<>::GetEnumerator", DateTime.Now.Ticks);
System\Linq\Parallel\QueryOperators\QueryOperator.cs (1)
175TraceHelpers.TraceInfo("[timing]: {0}: starting execution - QueryOperator<>::GetQueryResults", DateTime.Now.Ticks);
System\Linq\Parallel\Scheduling\QueryTask.cs (4)
63TraceHelpers.TraceInfo("[timing]: {0}: Running work synchronously", DateTime.Now.Ticks, _taskIndex); 83TraceHelpers.TraceInfo("[timing]: {0}: Queue work {1} to occur asynchronously", DateTime.Now.Ticks, _taskIndex); 95TraceHelpers.TraceInfo("[timing]: {0}: Start work {1}", DateTime.Now.Ticks, _taskIndex); 108TraceHelpers.TraceInfo("[timing]: {0}: End work {1}", DateTime.Now.Ticks, _taskIndex);
System\Linq\Parallel\Utils\Util.cs (4)
54else if (typeof(TKey) == typeof(DateTime)) 104private sealed class FastDateTimeComparer : Comparer<DateTime> 106public override int Compare(DateTime x, DateTime y)
System.Management (2)
artifacts\obj\System.Management\Debug\net10.0\System.Management.notsupported.cs (2)
212public static System.DateTime ToDateTime(string dmtfDate) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); } 213public static string ToDmtfDateTime(System.DateTime date) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
System.Net.Http (1)
System\Net\Http\DiagnosticsHandler.cs (1)
194activity.SetEndTime(DateTime.UtcNow);
System.Net.HttpListener (4)
src\libraries\Common\src\System\Net\CookieParser.cs (3)
649if (DateTime.TryParse(CheckQuoted(_tokenizer.Value), 650CultureInfo.InvariantCulture, DateTimeStyles.AllowWhiteSpaces | DateTimeStyles.AdjustToUniversal, out DateTime expires)) 668cookie!.Expires = DateTime.UtcNow.AddSeconds(parsed);
System\Net\Managed\HttpListenerResponse.Managed.cs (1)
173_webHeaders.Set(HttpKnownHeaderNames.Date, DateTime.UtcNow.ToString("r", CultureInfo.InvariantCulture));
System.Net.Mail (14)
System\Net\Mail\MailBnfHelper.cs (1)
250internal static string? GetDateTimeString(DateTime value, StringBuilder? builder)
System\Net\Mail\MailPriority.cs (1)
463MailBnfHelper.GetDateTimeString(DateTime.Now, null)!);
System\Net\Mime\ContentDisposition.cs (5)
66internal DateTime GetDateParameter(string parameterName) 69return dateValue == null ? DateTime.MinValue : dateValue.Date; 111public DateTime CreationDate 124public DateTime ModificationDate 147public DateTime ReadDate
System\Net\Mime\SmtpDateTime.cs (7)
88private readonly DateTime _date; 99internal SmtpDateTime(DateTime value) 137internal DateTime Date 143return DateTime.SpecifyKind(_date, DateTimeKind.Unspecified); 228internal static DateTime ParseValue(string data, out string timeZone) 261DateTime dateValue; 262if (!DateTime.TryParseExact(date, s_validDateTimeFormats, CultureInfo.InvariantCulture, DateTimeStyles.AllowWhiteSpaces, out dateValue))
System.Net.Primitives (26)
src\libraries\Common\src\System\Net\CookieParser.cs (3)
649if (DateTime.TryParse(CheckQuoted(_tokenizer.Value), 650CultureInfo.InvariantCulture, DateTimeStyles.AllowWhiteSpaces | DateTimeStyles.AdjustToUniversal, out DateTime expires)) 668cookie!.Expires = DateTime.UtcNow.AddSeconds(parsed);
System\Net\Cookie.cs (11)
56private DateTime m_expires = DateTime.MinValue; // Do not rename (binary serialization) 66private DateTime m_timeStamp = DateTime.UtcNow; // Do not rename (binary serialization) 201return (m_expires != DateTime.MinValue) && (m_expires.ToUniversalTime() <= DateTime.UtcNow); 207m_expires = DateTime.UtcNow; 212public DateTime Expires 566public DateTime TimeStamp 725if (Expires != DateTime.MinValue) 727int seconds = (int)(Expires.ToUniversalTime() - DateTime.UtcNow).TotalSeconds;
System\Net\CookieCollection.cs (6)
28private DateTime m_TimeStamp = DateTime.MinValue; // Do not rename (binary serialization) 155internal DateTime TimeStamp(Stamp how) 160m_TimeStamp = DateTime.Now; 163m_TimeStamp = DateTime.MaxValue; 166m_TimeStamp = DateTime.MinValue;
System\Net\CookieContainer.cs (6)
327DateTime oldUsed = DateTime.MaxValue; 328DateTime tempUsed; 390DateTime[] stamps; 394stamps = new DateTime[pathList.Count]; 449if (oldUsed == DateTime.MaxValue)
System.Net.Quic (1)
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.Crypto.cs (1)
152internal static void X509StoreSetVerifyTime(SafeX509StoreHandle ctx, DateTime verifyTime)
System.Net.Requests (35)
System\Net\Cache\HttpRequestCachePolicy.cs (8)
10private readonly DateTime _lastSyncDateUtc = DateTime.MinValue; 68public HttpRequestCachePolicy(DateTime cacheSyncDate) : 74public HttpRequestCachePolicy(HttpCacheAgeControl cacheAgeControl, TimeSpan maxAge, TimeSpan freshOrStale, DateTime cacheSyncDate) : 82public DateTime CacheSyncDate => 83_lastSyncDateUtc == DateTime.MinValue || _lastSyncDateUtc == DateTime.MaxValue ? 99(CacheSyncDate == DateTime.MinValue ? string.Empty : " CacheSyncDate:" + CacheSyncDate.ToString(CultureInfo.CurrentCulture));
System\Net\FtpControlStream.cs (5)
43private DateTime _lastModified; 222_lastModified = DateTime.MinValue; 851internal DateTime LastModified 917private DateTime GetLastModifiedFrom213Response(string str) 919DateTime dateTime = _lastModified;
System\Net\FtpWebRequest.cs (8)
194private DateTime _startTime; 542_startTime = DateTime.UtcNow; 547_remainingTimeout = Timeout - (int)((DateTime.UtcNow - _startTime).TotalMilliseconds); 729_startTime = DateTime.UtcNow; 734_remainingTimeout = Timeout - (int)((DateTime.UtcNow - _startTime).TotalMilliseconds); 875_remainingTimeout = Timeout - (int)((DateTime.UtcNow - _startTime).TotalMilliseconds); 900_remainingTimeout = Timeout - (int)((DateTime.UtcNow - _startTime).TotalMilliseconds); 1671_ftpWebResponse = new FtpWebResponse(responseStream, -1, _uri, FtpStatusCode.Undefined, null, DateTime.Now, null, null, null);
System\Net\FtpWebResponse.cs (3)
19private readonly DateTime _lastModified; 24internal FtpWebResponse(Stream? responseStream, long contentLength, Uri responseUri, FtpStatusCode statusCode, string? statusLine, DateTime lastModified, string? bannerMessage, string? welcomeMessage, string? exitMessage) 155public DateTime LastModified
System\Net\HttpWebRequest.cs (6)
724public DateTime IfModifiedSince 741public DateTime Date 1616private DateTime GetDateHeaderHelper(string headerName) 1622return DateTime.MinValue; // MinValue means header is not present 1634private void SetDateHeaderHelper(string headerName, DateTime dateTime) 1636SetSpecialHeaders(headerName, dateTime == DateTime.MinValue ?
System\Net\HttpWebResponse.cs (2)
141public DateTime LastModified 149return DateTime.Now;
System\Net\ServicePoint\ServicePoint.cs (1)
67public DateTime IdleSince { get; internal set; }
System\Net\ServicePoint\ServicePointManager.cs (2)
127sp.IdleSince = DateTime.Now; 154IdleSince = DateTime.Now,
System.Net.Security (15)
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.Crypto.cs (1)
152internal static void X509StoreSetVerifyTime(SafeX509StoreHandle ctx, DateTime verifyTime)
src\libraries\Common\src\System\Net\Security\Unix\SafeFreeCredentials.cs (3)
22internal DateTime _expiry; 24public DateTime Expiry => _expiry; 28_expiry = DateTime.MaxValue;
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\Security\SslSessionsCache.cs (3)
118if (credentials == null || credentials.IsClosed || credentials.IsInvalid || credentials.Expiry < DateTime.UtcNow) 161DateTime utcNow = DateTime.UtcNow;
System\Net\Security\SslStream.Protocol.cs (3)
784if (cred._expiry < DateTime.UtcNow) 796static DateTime GetExpiryTimestamp(SslStreamCertificateContext certificateContext) 798DateTime expiry = certificateContext.TargetCertificate.NotAfter;
System.Net.Sockets (3)
System\Net\Sockets\SocketAsyncContext.Unix.cs (3)
1391DateTime waitStart = DateTime.UtcNow; 1414timeout -= (DateTime.UtcNow - waitStart).Milliseconds;
System.Net.WebClient (1)
System\Net\WebClient.cs (1)
501string boundary = $"---------------------{DateTime.Now.Ticks:x}";
System.Private.CoreLib (967)
src\libraries\Common\src\System\TimeProvider.cs (2)
40private static readonly long s_minDateTicks = DateTime.MinValue.Ticks; 41private static readonly long s_maxDateTicks = DateTime.MaxValue.Ticks;
src\libraries\System.Private.CoreLib\src\System\Boolean.cs (1)
391DateTime IConvertible.ToDateTime(IFormatProvider? provider)
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Formatter\Utf8Formatter.Date.cs (2)
81public static bool TryFormat(DateTime value, Span<byte> destination, out int bytesWritten, StandardFormat format = default) 104private static bool TryFormatDateTimeL(DateTime value, Span<byte> destination, out int bytesWritten)
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.Date.cs (2)
32public static bool TryParse(ReadOnlySpan<byte> source, out DateTime value, out int bytesConsumed, char standardFormat = default) 129'G' => TryParseDateTimeG(source, out DateTime _, out value, out bytesConsumed),
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.Date.Default.cs (1)
25if (!TryParseDateTimeG(source, out DateTime dateTime, out _, out _))
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.Date.G.cs (1)
15private static bool TryParseDateTimeG(ReadOnlySpan<byte> source, out DateTime value, out DateTimeOffset valueAsOffset, out int bytesConsumed)
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\Byte.cs (1)
247DateTime IConvertible.ToDateTime(IFormatProvider? provider)
src\libraries\System.Private.CoreLib\src\System\Char.cs (1)
582DateTime IConvertible.ToDateTime(IFormatProvider? provider)
src\libraries\System.Private.CoreLib\src\System\Convert.cs (40)
205if (ReferenceEquals(targetType, typeof(DateTime))) 277if (ReferenceEquals(conversionType, typeof(DateTime))) 410public static bool ToBoolean(DateTime value) 522public static char ToChar(DateTime value) 645public static sbyte ToSByte(DateTime value) 748public static byte ToByte(DateTime value) 857public static short ToInt16(DateTime value) 972public static ushort ToUInt16(DateTime value) 1098public static int ToInt32(DateTime value) 1223public static uint ToUInt32(DateTime value) 1327public static long ToInt64(DateTime value) 1448public static ulong ToUInt64(DateTime value) 1551public static float ToSingle(DateTime value) 1654public static double ToDouble(DateTime value) 1757public static decimal ToDecimal(DateTime value) 1767public static DateTime ToDateTime(DateTime value) 1772public static DateTime ToDateTime(object? value) 1774return value == null ? DateTime.MinValue : ((IConvertible)value).ToDateTime(null); 1777public static DateTime ToDateTime(object? value, IFormatProvider? provider) 1779return value == null ? DateTime.MinValue : ((IConvertible)value).ToDateTime(provider); 1782public static DateTime ToDateTime(string? value) 1786return DateTime.Parse(value); 1789public static DateTime ToDateTime(string? value, IFormatProvider? provider) 1793return DateTime.Parse(value, provider); 1797public static DateTime ToDateTime(sbyte value) 1802public static DateTime ToDateTime(byte value) 1807public static DateTime ToDateTime(short value) 1813public static DateTime ToDateTime(ushort value) 1818public static DateTime ToDateTime(int value) 1824public static DateTime ToDateTime(uint value) 1829public static DateTime ToDateTime(long value) 1835public static DateTime ToDateTime(ulong value) 1840public static DateTime ToDateTime(bool value) 1845public static DateTime ToDateTime(char value) 1850public static DateTime ToDateTime(float value) 1855public static DateTime ToDateTime(double value) 1860public static DateTime ToDateTime(decimal value) 2022public static string ToString(DateTime value) 2027public static string ToString(DateTime value, IFormatProvider? provider)
src\libraries\System.Private.CoreLib\src\System\CurrentSystemTimeZone.cs (16)
36internal long GetUtcOffsetFromUniversalTime(DateTime time, ref bool isAmbiguousLocalDst) 51DateTime startTime = daylightTime.Start - offset; 52DateTime endTime = daylightTime.End - offset - daylightTime.Delta; 53DateTime ambiguousStart; 54DateTime ambiguousEnd; 94public override DateTime ToLocalTime(DateTime time) 103if (tick > DateTime.MaxTicks) 105return new DateTime(DateTime.MaxTicks, DateTimeKind.Local); 107if (tick < DateTime.MinTicks) 109return new DateTime(DateTime.MinTicks, DateTimeKind.Local); 126DateTime start = DateTime.MinValue; 127DateTime end = DateTime.MinValue; 147public override TimeSpan GetUtcOffset(DateTime time)
src\libraries\System.Private.CoreLib\src\System\DateOnly.cs (9)
30private const int MaxDayNumber = DateTime.DaysTo10000 - 1; 32private static uint DayNumberFromDateTime(DateTime dt) => (uint)((ulong)dt.Ticks / TimeSpan.TicksPerDay); 34internal DateTime GetEquivalentDateTime() => DateTime.CreateUnchecked(_dayNumber * TimeSpan.TicksPerDay); 217public DateTime ToDateTime(TimeOnly time) => DateTime.CreateUnchecked(_dayNumber * TimeSpan.TicksPerDay + time.Ticks); 225public DateTime ToDateTime(TimeOnly time, DateTimeKind kind) => DateTime.SpecifyKind(ToDateTime(time), kind); 232public static DateOnly FromDateTime(DateTime dateTime) => new DateOnly(DayNumberFromDateTime(dateTime));
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; 1546public static DateTime Today => Now.Date; 1579public static DateTime Parse(string s) 1589public static DateTime Parse(string s, IFormatProvider? provider) 1595public static DateTime Parse(string s, IFormatProvider? provider, DateTimeStyles styles) 1602public static DateTime Parse(ReadOnlySpan<char> s, IFormatProvider? provider = null, DateTimeStyles styles = DateTimeStyles.None) 1612public static DateTime ParseExact(string s, [StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string format, IFormatProvider? provider) 1623public static DateTime ParseExact(string s, [StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string format, IFormatProvider? provider, DateTimeStyles style) 1631public static DateTime ParseExact(ReadOnlySpan<char> s, [StringSyntax(StringSyntaxAttribute.DateTimeFormat)] ReadOnlySpan<char> format, IFormatProvider? provider, DateTimeStyles style = DateTimeStyles.None) 1637public static DateTime ParseExact(string s, [StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string[] formats, IFormatProvider? provider, DateTimeStyles style) 1644public static DateTime ParseExact(ReadOnlySpan<char> s, [StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string[] formats, IFormatProvider? provider, DateTimeStyles style = DateTimeStyles.None) 1650public TimeSpan Subtract(DateTime value) 1655public DateTime Subtract(TimeSpan value) 1714public DateTime ToLocalTime() 1780public DateTime ToUniversalTime() 1783public static bool TryParse([NotNullWhen(true)] string? s, out DateTime result) 1793public static bool TryParse(ReadOnlySpan<char> s, out DateTime result) 1798public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, DateTimeStyles styles, out DateTime result) 1811public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, DateTimeStyles styles, out DateTime result) 1817public static bool TryParseExact([NotNullWhen(true)] string? s, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string? format, IFormatProvider? provider, DateTimeStyles style, out DateTime result) 1830public static bool TryParseExact(ReadOnlySpan<char> s, [StringSyntax(StringSyntaxAttribute.DateTimeFormat)] ReadOnlySpan<char> format, IFormatProvider? provider, DateTimeStyles style, out DateTime result) 1836public static bool TryParseExact([NotNullWhen(true)] string? s, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string?[]? formats, IFormatProvider? provider, DateTimeStyles style, out DateTime result) 1849public static bool TryParseExact(ReadOnlySpan<char> s, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string?[]? formats, IFormatProvider? provider, DateTimeStyles style, out DateTime result) 1855public static DateTime operator +(DateTime d, TimeSpan t) 1862public static DateTime operator -(DateTime d, TimeSpan t) 1869public static TimeSpan operator -(DateTime d1, DateTime d2) => new TimeSpan(d1.Ticks - d2.Ticks); 1871public static bool operator ==(DateTime d1, DateTime d2) => ((d1._dateData ^ d2._dateData) << 2) == 0; 1873public static bool operator !=(DateTime d1, DateTime d2) => !(d1 == d2); 1876public static bool operator <(DateTime t1, DateTime t2) => t1.Ticks < t2.Ticks; 1879public static bool operator <=(DateTime t1, DateTime t2) => t1.Ticks <= t2.Ticks; 1882public static bool operator >(DateTime t1, DateTime t2) => t1.Ticks > t2.Ticks; 1885public static bool operator >=(DateTime t1, DateTime t2) => t1.Ticks >= t2.Ticks; 1888/// Deconstructs <see cref="DateTime"/> into <see cref="DateOnly"/> and <see cref="TimeOnly"/>. 1973private static InvalidCastException InvalidCast(string to) => new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, nameof(DateTime), to)); 1975DateTime IConvertible.ToDateTime(IFormatProvider? provider) => this; 1982internal static bool TryCreate(int year, int month, int day, int hour, int minute, int second, int millisecond, out DateTime result) 2032public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out DateTime result) => TryParse(s, provider, DateTimeStyles.None, out result); 2039public static DateTime Parse(ReadOnlySpan<char> s, IFormatProvider? provider) => Parse(s, provider, DateTimeStyles.None); 2042public 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\DateTime.Unix.cs (3)
10public static DateTime UtcNow 21private static DateTime FromFileTimeLeapSecondsAware(ulong fileTime) => default; 27internal static bool IsValidTimeWithLeapSeconds(DateTime value) => false;
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\DateTimeOffset.NonAndroid.cs (1)
10public static DateTimeOffset Now => ToLocalTime(DateTime.UtcNow, true);
src\libraries\System.Private.CoreLib\src\System\DBNull.cs (1)
107DateTime IConvertible.ToDateTime(IFormatProvider? provider)
src\libraries\System.Private.CoreLib\src\System\Decimal.cs (1)
1099DateTime IConvertible.ToDateTime(IFormatProvider? provider)
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\CounterGroup.cs (8)
145private DateTime _timeStampSinceCollectionStarted; 147private DateTime _nextPollingTimeStamp; 159_timeStampSinceCollectionStarted = DateTime.UtcNow; 160_nextPollingTimeStamp = DateTime.UtcNow + new TimeSpan(0, 0, (int)pollingIntervalInSeconds); 228DateTime now; 234now = DateTime.UtcNow; 295DateTime now = DateTime.UtcNow;
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\Diagnostics\Tracing\EventPipeEventDispatcher.Threads.cs (2)
11private void StartDispatchTask(ulong sessionID, DateTime syncTimeUtc, long syncTimeQPC, long timeQPCFrequency) 21private void DispatchEventsToEventListeners(ulong sessionID, DateTime syncTimeUtc, long syncTimeQPC, long timeQPCFrequency, Task? previousDispatchTask, CancellationToken token)
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventProvider.cs (3)
397else if (data is DateTime) 403if (((DateTime)data).Ticks > UTCMinTicks) 404dateTimeTicks = ((DateTime)data).ToFileTimeUtc();
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventSource.cs (4)
1238public static implicit operator EventSourcePrimitive(DateTime value) => new(value); 1885decoded = DateTime.FromFileTimeUtc(*(long*)dataPointer); 4929public DateTime TimeStamp { get; internal set; } 4935TimeStamp = DateTime.UtcNow;
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\NativeRuntimeEventSource.cs (1)
44internal unsafe void ProcessEvent(uint eventID, uint osThreadID, DateTime timeStamp, Guid activityId, Guid childActivityId, ReadOnlySpan<byte> payload)
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\PropertyValue.cs (7)
55public DateTime AsDateTime; 98private PropertyValue(DateTime value) : this(new Scalar() { AsDateTime = value }, sizeof(DateTime)) { } 120if (type == typeof(DateTime)) return value => new PropertyValue((DateTime)value!); 245if (type == typeof(DateTime)) { var f = GetGetMethod<DateTime>(property); return container => new PropertyValue(f((TContainer)container.ReferenceValue!)); }
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\SimpleTypeInfos.cs (2)
205public DateTimeTypeInfo() : base(typeof(DateTime)) { } 219DateTime dateTime = value.ScalarValue.AsDateTime;
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\Statics.cs (1)
540else if (dataType == typeof(DateTime))
src\libraries\System.Private.CoreLib\src\System\Double.cs (1)
517DateTime IConvertible.ToDateTime(IFormatProvider? provider)
src\libraries\System.Private.CoreLib\src\System\Enum.cs (1)
2190DateTime IConvertible.ToDateTime(IFormatProvider? provider) => throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Enum", "DateTime"));
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\CalendricalCalculationsHelper.cs (2)
59internal static long GetNumberOfDays(DateTime date) 66return new DateTime(Math.Min((long)(Math.Floor(numberOfDays) * TimeSpan.TicksPerDay), DateTime.MaxValue.Ticks)).Year;
src\libraries\System.Private.CoreLib\src\System\Globalization\ChineseLunisolarCalendar.cs (8)
21private static readonly DateTime s_minDate = new DateTime(1901, 2, 19); 22private static readonly DateTime s_maxDate = new DateTime((new DateTime(2101, 1, 28, 23, 59, 59, 999)).Ticks + 9999); 24public override DateTime MinSupportedDateTime => s_minDate; 26public override DateTime MaxSupportedDateTime => s_maxDate; 248internal override DateTime MinDate => s_minDate; 250internal override DateTime MaxDate => s_maxDate; 264internal override int GetYear(int year, DateTime time) 287public override int GetEra(DateTime time)
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); 4967if (!DateTime.TryCreate(year, month, day, hour, minute, second, 0, out result.parsedDate)) 5100if (!DateTime.TryCreate(year, month, day, hour, minute, second, 0, out DateTime dateTime)) 6108internal DateTime parsedDate;
src\libraries\System.Private.CoreLib\src\System\Globalization\DaylightTime.cs (10)
9private readonly DateTime _start; 10private readonly DateTime _end; 13public DaylightTime(DateTime start, DateTime end, TimeSpan delta) 21public DateTime Start => _start; 24public DateTime End => _end; 33public DaylightTimeStruct(DateTime start, DateTime end, TimeSpan delta) 40public readonly DateTime Start; 41public readonly DateTime End;
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\ISOWeek.cs (7)
17public static int GetWeekOfYear(DateTime date) 45public static int GetYear(DateTime date) 77public static DateTime GetYearStart(int year) 86public static DateTime GetYearEnd(int year) 132public static DateTime ToDateTime(int year, int week, DayOfWeek dayOfWeek) 152var jan4 = new DateTime(year, month: 1, day: 4); 179private static int GetWeekNumber(DateTime date)
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\JapaneseCalendar.Icu.cs (2)
55DateTime dt; 139private static bool GetJapaneseEraStartDate(int era, out DateTime dateTime)
src\libraries\System.Private.CoreLib\src\System\Globalization\JapaneseLunisolarCalendar.cs (8)
22private static readonly DateTime s_minDate = new DateTime(1960, 1, 28); 23private static readonly DateTime s_maxDate = new DateTime((new DateTime(2050, 1, 22, 23, 59, 59, 999)).Ticks + 9999); 25public override DateTime MinSupportedDateTime => s_minDate; 27public override DateTime MaxSupportedDateTime => s_maxDate; 135internal override DateTime MinDate => s_minDate; 137internal override DateTime MaxDate => s_maxDate; 154internal override int GetYear(int year, DateTime time) 207public override int GetEra(DateTime time) => _helper.GetEra(time);
src\libraries\System.Private.CoreLib\src\System\Globalization\JulianCalendar.cs (15)
38public override DateTime MinSupportedDateTime => DateTime.MinValue; 40public override DateTime MaxSupportedDateTime => DateTime.MaxValue; 180public override DateTime AddMonths(DateTime time, int months) 217public override DateTime AddYears(DateTime time, int years) 222public override int GetDayOfMonth(DateTime time) 227public override DayOfWeek GetDayOfWeek(DateTime time) => time.DayOfWeek; 229public override int GetDayOfYear(DateTime time) 248public override int GetEra(DateTime time) => JulianEra; 250public override int GetMonth(DateTime time) 263public override int GetYear(DateTime time) 301public 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\KoreanLunisolarCalendar.cs (8)
20private static readonly DateTime s_minDate = new DateTime(918, 2, 19); 21private static readonly DateTime s_maxDate = new DateTime((new DateTime(2051, 2, 10, 23, 59, 59, 999)).Ticks + 9999); 23public override DateTime MinSupportedDateTime => s_minDate; 25public override DateTime MaxSupportedDateTime => s_maxDate; 1177internal override DateTime MinDate => s_minDate; 1179internal override DateTime MaxDate => s_maxDate; 1196internal override int GetYear(int year, DateTime time) 1222public override int GetEra(DateTime time)
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\TaiwanLunisolarCalendar.cs (8)
30private static readonly DateTime s_minDate = new DateTime(1912, 2, 18); 31private static readonly DateTime s_maxDate = new DateTime((new DateTime(2051, 2, 10, 23, 59, 59, 999)).Ticks + 9999); 33public override DateTime MinSupportedDateTime => s_minDate; 35public override DateTime MaxSupportedDateTime => s_maxDate; 191internal override DateTime MinDate => s_minDate; 193internal override DateTime MaxDate => s_maxDate; 210internal override int GetYear(int year, DateTime time) 225public override int GetEra(DateTime time) => _helper.GetEra(time);
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\IConvertible.cs (1)
57DateTime ToDateTime(IFormatProvider? provider);
src\libraries\System.Private.CoreLib\src\System\Int16.cs (1)
250DateTime IConvertible.ToDateTime(IFormatProvider? provider)
src\libraries\System.Private.CoreLib\src\System\Int32.cs (1)
265DateTime IConvertible.ToDateTime(IFormatProvider? provider)
src\libraries\System.Private.CoreLib\src\System\Int64.cs (1)
262DateTime IConvertible.ToDateTime(IFormatProvider? provider)
src\libraries\System.Private.CoreLib\src\System\IO\Directory.cs (12)
100public static void SetCreationTime(string path, DateTime creationTime) 106public static void SetCreationTimeUtc(string path, DateTime creationTimeUtc) 112public static DateTime GetCreationTime(string path) 117public static DateTime GetCreationTimeUtc(string path) 122public static void SetLastWriteTime(string path, DateTime lastWriteTime) 128public static void SetLastWriteTimeUtc(string path, DateTime lastWriteTimeUtc) 134public static DateTime GetLastWriteTime(string path) 139public static DateTime GetLastWriteTimeUtc(string path) 144public static void SetLastAccessTime(string path, DateTime lastAccessTime) 150public static void SetLastAccessTimeUtc(string path, DateTime lastAccessTimeUtc) 156public static DateTime GetLastAccessTime(string path) 161public static DateTime GetLastAccessTimeUtc(string path)
src\libraries\System.Private.CoreLib\src\System\IO\File.cs (37)
176internal static DateTimeOffset GetUtcDateTimeOffset(DateTime dateTime) 184public static void SetCreationTime(string path, DateTime creationTime) 194/// A <see cref="DateTime"/> containing the value to set for the creation date and time of <paramref name="fileHandle"/>. 209public static void SetCreationTime(SafeFileHandle fileHandle, DateTime creationTime) 215public static void SetCreationTimeUtc(string path, DateTime creationTimeUtc) 226/// A <see cref="DateTime"/> containing the value to set for the creation date and time of <paramref name="fileHandle"/>. 241public static void SetCreationTimeUtc(SafeFileHandle fileHandle, DateTime creationTimeUtc) 247public static DateTime GetCreationTime(string path) 257/// A <see cref="DateTime" /> structure set to the creation date and time for the specified file or 266public static DateTime GetCreationTime(SafeFileHandle fileHandle) 272public static DateTime GetCreationTimeUtc(string path) 282/// A <see cref="DateTime" /> structure set to the creation date and time for the specified file or 291public static DateTime GetCreationTimeUtc(SafeFileHandle fileHandle) 297public static void SetLastAccessTime(string path, DateTime lastAccessTime) 307/// A <see cref="DateTime"/> containing the value to set for the last access date and time of <paramref name="fileHandle"/>. 322public static void SetLastAccessTime(SafeFileHandle fileHandle, DateTime lastAccessTime) 328public static void SetLastAccessTimeUtc(string path, DateTime lastAccessTimeUtc) 338/// A <see cref="DateTime"/> containing the value to set for the last access date and time of <paramref name="fileHandle"/>. 353public static void SetLastAccessTimeUtc(SafeFileHandle fileHandle, DateTime lastAccessTimeUtc) 359public static DateTime GetLastAccessTime(string path) 369/// A <see cref="DateTime" /> structure set to the last access date and time for the specified file or 378public static DateTime GetLastAccessTime(SafeFileHandle fileHandle) 384public static DateTime GetLastAccessTimeUtc(string path) 394/// A <see cref="DateTime" /> structure set to the last access date and time for the specified file or 403public static DateTime GetLastAccessTimeUtc(SafeFileHandle fileHandle) 409public static void SetLastWriteTime(string path, DateTime lastWriteTime) 419/// A <see cref="DateTime"/> containing the value to set for the last write date and time of <paramref name="fileHandle"/>. 434public static void SetLastWriteTime(SafeFileHandle fileHandle, DateTime lastWriteTime) 440public static void SetLastWriteTimeUtc(string path, DateTime lastWriteTimeUtc) 450/// A <see cref="DateTime"/> containing the value to set for the last write date and time of <paramref name="fileHandle"/>. 465public static void SetLastWriteTimeUtc(SafeFileHandle fileHandle, DateTime lastWriteTimeUtc) 471public static DateTime GetLastWriteTime(string path) 481/// A <see cref="DateTime" /> structure set to the last write date and time for the specified file or 490public static DateTime GetLastWriteTime(SafeFileHandle fileHandle) 496public static DateTime GetLastWriteTimeUtc(string path) 506/// A <see cref="DateTime" /> structure set to the last write date and time for the specified file or 515public static DateTime GetLastWriteTimeUtc(SafeFileHandle fileHandle)
src\libraries\System.Private.CoreLib\src\System\IO\FileStatus.Unix.cs (3)
302return new DateTimeOffset(DateTime.FromFileTimeUtc(0)); 326return new DateTimeOffset(DateTime.FromFileTimeUtc(0)); 351return new DateTimeOffset(DateTime.FromFileTimeUtc(0));
src\libraries\System.Private.CoreLib\src\System\IO\FileSystemInfo.cs (6)
72public DateTime CreationTime 78public DateTime CreationTimeUtc 84public DateTime LastAccessTime 90public DateTime LastAccessTimeUtc 96public DateTime LastWriteTime 102public DateTime LastWriteTimeUtc
src\libraries\System.Private.CoreLib\src\System\Resources\ResourceReader.cs (2)
592else if (type == typeof(DateTime)) 696return DateTime.FromBinary(data);
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\DateTimeConstantAttribute.cs (1)
9private readonly DateTime _date;
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\ComVariant.cs (4)
290else if (typeof(T) == typeof(DateTime)) 293variant._typeUnion._unionTypes._date = ((DateTime)(object)value).ToOADate(); 480else if (typeof(T) == typeof(DateTime)) 483return (T)(object)DateTime.FromOADate(_typeUnion._unionTypes._date);
src\libraries\System.Private.CoreLib\src\System\Runtime\Serialization\IFormatterConverter.cs (1)
25DateTime ToDateTime(object value);
src\libraries\System.Private.CoreLib\src\System\Runtime\Serialization\SerializationInfo.cs (5)
222public void AddValue(string name, DateTime value) 224AddValue(name, (object)value, typeof(DateTime)); 455public DateTime GetDateTime(string name) 458return ReferenceEquals(foundType, typeof(DateTime)) ? (DateTime)value! : _converter.ToDateTime(value!);
src\libraries\System.Private.CoreLib\src\System\SByte.cs (1)
253DateTime IConvertible.ToDateTime(IFormatProvider? provider)
src\libraries\System.Private.CoreLib\src\System\Single.cs (1)
512DateTime IConvertible.ToDateTime(IFormatProvider? provider)
src\libraries\System.Private.CoreLib\src\System\Threading\Timer.cs (3)
45internal static readonly (long TickCount, DateTime Time) s_tickCountToTimeMap = (TickCount64, DateTime.UtcNow); 752public DateTime? EstimatedNextTimeUtc
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\TimeZone.cs (16)
80public abstract TimeSpan GetUtcOffset(DateTime time); 85public virtual DateTime ToUniversalTime(DateTime time) 92if (tickCount > DateTime.MaxTicks) 94return new DateTime(DateTime.MaxTicks, DateTimeKind.Utc); 96if (tickCount < DateTime.MinTicks) 98return new DateTime(DateTime.MinTicks, DateTimeKind.Utc); 106public virtual DateTime ToLocalTime(DateTime time) 122public virtual bool IsDaylightSavingTime(DateTime time) 129public static bool IsDaylightSavingTime(DateTime time, DaylightTime daylightTimes) 194internal static TimeSpan CalculateUtcOffset(DateTime time, DaylightTime daylightTimes) 206DateTime startTime; 207DateTime endTime; 217DateTime ambiguousStart; 218DateTime ambiguousEnd;
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.cs (108)
143private static readonly DateTime s_maxDateOnly = new DateTime(9999, 12, 31); 144private static readonly DateTime s_minDateOnly = new DateTime(1, 1, 2); 201DateTime adjustedTime = ConvertTime(dateTimeOffset, this).DateTime; 239public TimeSpan[] GetAmbiguousTimeOffsets(DateTime dateTime) 246DateTime adjustedTime; 294private AdjustmentRule? GetAdjustmentRuleForAmbiguousOffsets(DateTime adjustedTime, out int? ruleIndex) 348public TimeSpan GetUtcOffset(DateTime dateTime) => 352internal static TimeSpan GetLocalUtcOffset(DateTime dateTime, TimeZoneInfoOptions flags) 361internal TimeSpan GetUtcOffset(DateTime dateTime, TimeZoneInfoOptions flags) => 364private TimeSpan GetUtcOffset(DateTime dateTime, TimeZoneInfoOptions flags, CachedData cachedData) 373DateTime adjustedTime = ConvertTime(dateTime, cachedData.Local, s_utcTimeZone, flags); 430public bool IsAmbiguousTime(DateTime dateTime) => 437internal bool IsAmbiguousTime(DateTime dateTime, TimeZoneInfoOptions flags) 445DateTime adjustedTime = 471public bool IsDaylightSavingTime(DateTime dateTime) => 477internal bool IsDaylightSavingTime(DateTime dateTime, TimeZoneInfoOptions flags) => 480private bool IsDaylightSavingTime(DateTime dateTime, TimeZoneInfoOptions flags, CachedData cachedData) 500DateTime adjustedTime; 548public bool IsInvalidTime(DateTime dateTime) 590public static DateTime ConvertTimeBySystemTimeZoneId(DateTime dateTime, string destinationTimeZoneId) => 680public static DateTime ConvertTimeBySystemTimeZoneId(DateTime dateTime, string sourceTimeZoneId, string destinationTimeZoneId) 710DateTime utcDateTime = dateTimeOffset.UtcDateTime; 717ticks > DateTime.MaxTicks ? DateTimeOffset.MaxValue : 718ticks < DateTime.MinTicks ? DateTimeOffset.MinValue : 725public static DateTime ConvertTime(DateTime dateTime, TimeZoneInfo destinationTimeZone) 742public static DateTime ConvertTime(DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone) => 748internal static DateTime ConvertTime(DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone, TimeZoneInfoOptions flags) => 751private static DateTime ConvertTime(DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone, TimeZoneInfoOptions flags, CachedData cachedData) 804DateTime targetConverted = ConvertUtcToTimeZone(utcTicks, destinationTimeZone, out bool isAmbiguousLocalDst); 821public static DateTime ConvertTimeFromUtc(DateTime dateTime, TimeZoneInfo destinationTimeZone) => 827public static DateTime ConvertTimeToUtc(DateTime dateTime) 840internal static DateTime ConvertTimeToUtc(DateTime dateTime, TimeZoneInfoOptions flags) 850public static DateTime ConvertTimeToUtc(DateTime dateTime, TimeZoneInfo sourceTimeZone) => 1170private AdjustmentRule? GetAdjustmentRuleForTime(DateTime dateTime, out int? ruleIndex) 1178private AdjustmentRule? GetAdjustmentRuleForTime(DateTime dateTime, bool dateTimeisUtc, out int? ruleIndex) 1190DateTime date = dateTimeisUtc ? 1233DateTime dateTime, DateTime dateOnly, bool dateTimeisUtc) 1238DateTime dateTimeToCompare = dateTimeisUtc ? 1260DateTime dateTimeToCompare = dateTimeisUtc ? 1278private DateTime ConvertToUtc(DateTime dateTime, TimeSpan daylightDelta, TimeSpan baseUtcOffsetDelta) => 1284private DateTime ConvertFromUtc(DateTime dateTime, TimeSpan daylightDelta, TimeSpan baseUtcOffsetDelta) => 1290private DateTime ConvertToFromUtc(DateTime dateTime, TimeSpan daylightDelta, TimeSpan baseUtcOffsetDelta, bool convertToUtc) 1301ticks > DateTime.MaxTicks ? DateTime.MaxValue : 1302ticks < DateTime.MinTicks ? DateTime.MinValue : 1311private static DateTime ConvertUtcToTimeZone(long ticks, TimeZoneInfo destinationTimeZone, out bool isAmbiguousLocalDst) 1314DateTime utcConverted = 1315ticks > DateTime.MaxTicks ? DateTime.MaxValue : 1316ticks < DateTime.MinTicks ? DateTime.MinValue : 1324ticks > DateTime.MaxTicks ? DateTime.MaxValue : 1325ticks < DateTime.MinTicks ? DateTime.MinValue : 1335DateTime startTime; 1336DateTime endTime; 1361private static bool GetIsDaylightSavings(DateTime time, AdjustmentRule rule, DaylightTimeStruct daylightTime) 1368DateTime startTime; 1369DateTime endTime; 1461private static bool GetIsDaylightSavingsFromUtc(DateTime time, int year, TimeSpan utc, AdjustmentRule rule, int? ruleIndex, out bool isAmbiguousLocalDst, TimeZoneInfo zone) 1486DateTime startTime; 1504DateTime endTime; 1521DateTime ambiguousStart; 1522DateTime ambiguousEnd; 1547DateTime ambiguousStartModified; 1548DateTime ambiguousEndModified; 1575private static bool TryGetEndOfDstIfYearStartWithDst(int nextYear, TimeSpan utc, TimeZoneInfo zone, out DateTime dstEnd) 1625private static bool TryGetStartOfDstIfYearEndWithDst(int previousYear, TimeSpan utc, TimeZoneInfo zone, out DateTime dstStart) 1649private static bool CheckIsDst(DateTime startTime, DateTime time, DateTime endTime, bool ignoreYearAdjustment, AdjustmentRule rule) 1700private static bool GetIsAmbiguousTime(DateTime time, AdjustmentRule rule, DaylightTimeStruct daylightTime) 1708DateTime startAmbiguousTime; 1709DateTime endAmbiguousTime; 1738DateTime startModifiedAmbiguousTime; 1739DateTime endModifiedAmbiguousTime; 1770private static bool GetIsInvalidTime(DateTime time, AdjustmentRule rule, DaylightTimeStruct daylightTime) 1778DateTime startInvalidTime; 1779DateTime endInvalidTime; 1808DateTime startModifiedInvalidTime; 1809DateTime endModifiedInvalidTime; 1836private static TimeSpan GetUtcOffset(DateTime time, TimeZoneInfo zone) 1859private static TimeSpan GetUtcOffsetFromUtc(DateTime time, TimeZoneInfo zone) => 1866private static TimeSpan GetUtcOffsetFromUtc(DateTime time, TimeZoneInfo zone, out bool isDaylightSavings) => 1873internal static TimeSpan GetUtcOffsetFromUtc(DateTime time, TimeZoneInfo zone, out bool isDaylightSavings, out bool isAmbiguousLocalDst) 1884rule = zone.GetAdjustmentRuleForTime(DateTime.MaxValue, out ruleIndex); 1889rule = zone.GetAdjustmentRuleForTime(DateTime.MinValue, out ruleIndex); 1902DateTime targetTime = time + baseOffset; 1922internal static DateTime TransitionTimeToDateTime(int year, TransitionTime transitionTime) 1924DateTime value; 1935int daysInMonth = DateTime.DaysInMonth(year, transitionTime.Month); 1971int daysInMonth = DateTime.DaysInMonth(year, transitionTime.Month);
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.StringSerializer.cs (6)
331private DateTime GetNextDateTimeValue(string format) 334if (!DateTime.TryParseExact(token, format, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.None, out DateTime time)) 430DateTime dateStart = GetNextDateTimeValue(DateTimeFormat); 431DateTime dateEnd = GetNextDateTimeValue(DateTimeFormat); 538DateTime timeOfDay = TimeOnly.FromDateTime(GetNextDateTimeValue(TimeOfDayFormat)).ToDateTime();
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 (32)
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 358internal static TimeSpan GetDateTimeNowUtcOffsetFromUtc(DateTime time, out bool isAmbiguousLocalDst) 493private static void TZif_GenerateAdjustmentRules(out AdjustmentRule[]? rules, TimeSpan baseUtcOffset, DateTime[] dts, byte[] typeOfLocalTime, 516private static void TZif_GenerateAdjustmentRule(ref int index, TimeSpan timeZoneBaseUtcOffset, List<AdjustmentRule> rulesList, DateTime[] dts, 536while (index < dts.Length && dts[index] == DateTime.MinValue) 544DateTime endTransitionDate = dts[index]; 551DateTime.MinValue, 568DateTime startTransitionDate = dts[index - 1]; 571DateTime endTransitionDate = dts[index]; 614DateTime startTransitionDate = dts[index - 1]; 631DateTime.MaxValue, 699private static AdjustmentRule? TZif_CreateAdjustmentRuleForPosixFormat(string posixFormat, DateTime startTransitionDate, TimeSpan timeZoneBaseUtcOffset) 746DateTime.MaxValue, 758DateTime.MaxValue, 809private static DateTime ParseTimeOfDay(ReadOnlySpan<char> time) 811DateTime timeOfDay; 1138private static DateTime TZif_UnixTimeToDateTime(long unixTime) => 1139unixTime < DateTimeOffset.UnixMinSeconds ? DateTime.MinValue : 1140unixTime > DateTimeOffset.UnixMaxSeconds ? DateTime.MaxValue : 1143private static void TZif_ParseRaw(byte[] data, out DateTime[] dts, out byte[] typeOfLocalTime, out TZifType[] transitionType, 1167dts = new DateTime[t.TimeCount];
src\libraries\System.Private.CoreLib\src\System\Type.cs (1)
537else if (underlyingType == typeof(DateTime))
src\libraries\System.Private.CoreLib\src\System\UInt16.cs (1)
244DateTime IConvertible.ToDateTime(IFormatProvider? provider)
src\libraries\System.Private.CoreLib\src\System\UInt32.cs (1)
260DateTime IConvertible.ToDateTime(IFormatProvider? provider)
src\libraries\System.Private.CoreLib\src\System\UInt64.cs (1)
259DateTime IConvertible.ToDateTime(IFormatProvider? provider)
src\System\Reflection\Emit\RuntimeTypeBuilder.cs (2)
278else if (type == typeof(DateTime)) 281long ticks = ((DateTime)value).Ticks;
src\System\Reflection\InstanceCalliHelper.cs (4)
27internal static DateTime Call(delegate*<object, DateTime> fn, object o) => fn(o); 89internal static void Call(delegate*<object, DateTime, void> fn, object o, DateTime arg1) => fn(o, arg1);
src\System\Reflection\MdConstant.cs (1)
77else if (fieldType == typeof(DateTime))
src\System\Reflection\RuntimeParameterInfo.cs (1)
395private static DateTime GetRawDateTimeConstant(CustomAttributeData attr)
src\System\StubHelpers.cs (2)
533internal static double ConvertToNative(DateTime managedDate) 540return DateTime.DoubleDateToTicks(nativeDate);
System.Private.DataContractSerialization (108)
System\Runtime\Serialization\DataContract.cs (1)
638"DateTime" => typeof(DateTime),
System\Runtime\Serialization\DateTimeOffsetAdapter.cs (3)
15private DateTime _utcDateTime; 18public DateTimeOffsetAdapter(DateTime dateTime, short offsetMinutes) 25public DateTime UtcDateTime
System\Runtime\Serialization\ExtensionDataReader.cs (3)
692DateTime dateTime = isTypedNode ? ((DataNode<DateTime>)dataNode).GetValue() : (DateTime)dataNode.Value;
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\JsonWriterDelegator.cs (5)
129internal void WriteJsonDateTimeArray(DateTime[] value, XmlDictionaryString itemName, XmlDictionaryString? itemNamespace) 161internal override void WriteDateTime(DateTime value) 173private void WriteDateTimeInDefaultFormat(DateTime value) 195if ((tickCount > DateTime.MaxValue.Ticks) || (tickCount < DateTime.MinValue.Ticks))
System\Runtime\Serialization\Json\ReflectionJsonFormatWriter.cs (1)
160jsonWriter.WriteJsonDateTimeArray((DateTime[])obj, collectionItemName, itemNamespace);
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\Runtime\Serialization\PrimitiveDataContract.cs (3)
678public DateTimeDataContract() : base(typeof(DateTime), DictionaryGlobals.DateTimeLocalName, DictionaryGlobals.SchemaNamespace) 689writer.WriteDateTime((DateTime)obj); 704xmlWriter.WriteDateTime((DateTime)obj!, name, ns);
System\Runtime\Serialization\ReflectionReader.cs (1)
647DateTime[]? dateTimeArray;
System\Runtime\Serialization\ReflectionXmlFormatWriter.cs (1)
108xmlWriter.WriteDateTimeArray((DateTime[])obj, collectionItemName, itemNamespace);
System\Runtime\Serialization\XmlReaderDelegator.cs (5)
303return new DataNode<DateTime>(ReadContentAsDateTime()); 496internal virtual DateTime ReadElementContentAsDateTime() 504internal virtual DateTime ReadContentAsDateTime() 834int arrayLength, [NotNullWhen(true)] out DateTime[]? array) 845array = new DateTime[arrayLength];
System\Runtime\Serialization\XmlSerializableReader.cs (1)
118public override DateTime ReadContentAsDateTime() { return InnerReader.ReadContentAsDateTimeOffset().DateTime; }
System\Runtime\Serialization\XmlWriterDelegator.cs (5)
315WriteDateTime((DateTime)value); 392WriteDateTime(((DataNode<DateTime>)dataNode).GetValue()); 456internal virtual void WriteDateTime(DateTime value) 461internal void WriteDateTime(DateTime value, XmlDictionaryString name, XmlDictionaryString? ns) 691internal void WriteDateTimeArray(DateTime[] value, XmlDictionaryString itemName, XmlDictionaryString itemNamespace)
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\ValueHandle.cs (2)
179return typeof(DateTime); 375public DateTime ToDateTime()
System\Xml\XmlBaseReader.cs (5)
1580public override DateTime ReadContentAsDateTime() 1585DateTime value = node.Value.ToDateTime(); 1703else if (type == typeof(DateTime)) 1852public override DateTime[] ReadDateTimeArray(string localName, string namespaceUri) 1857public override DateTime[] ReadDateTimeArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri)
System\Xml\XmlBaseWriter.cs (3)
1197else if (value is DateTime) 1199WriteValue((DateTime)value); 1367public override void WriteValue(DateTime value)
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\XmlBinaryWriter.cs (5)
791public override void WriteDateTimeText(DateTime dt) 974public void WriteDateTimeArray(ReadOnlySpan<DateTime> items) 977foreach (DateTime dateTime in items) 1229else if (type == typeof(DateTime)) 1414public override void WriteArray(string? prefix, string localName, string? namespaceUri, DateTime[] array, int offset, int count)
System\Xml\XmlBufferReader.cs (2)
421public DateTime ReadDateTime() 427return DateTime.FromBinary(value);
System\Xml\XmlConverter.cs (14)
203public static DateTime ToDateTime(long value) 207return DateTime.FromBinary(value); 215public static DateTime ToDateTime(string value) 231public static DateTime ToDateTime(byte[] buffer, int offset, int count) 233DateTime value; 395public static string ToString(DateTime value) 422else if (value is DateTime) 423return ToString((DateTime)value); 842private static bool TryParseDateTime(byte[] chars, int offset, int count, out DateTime result) 845result = DateTime.MaxValue; 929DateTime value; 948if (hourDelta >= 0 && (value < DateTime.MaxValue - ts) || 949hourDelta < 0 && (value > DateTime.MinValue - ts)) 1039public static int ToChars(DateTime value, byte[] chars, int offset)
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\Xml\XmlNodeWriter.cs (2)
87public abstract void WriteDateTimeText(DateTime value); 137public override void WriteDateTimeText(DateTime value) { }
System\Xml\XmlSigningNodeWriter.cs (1)
287public override void WriteDateTimeText(DateTime value)
System\Xml\XmlUTF8TextWriter.cs (1)
586public override void WriteDateTimeText(DateTime value)
System.Private.Windows.Core (68)
System\IO\BinaryReaderExtensions.cs (11)
15/// Reads a binary formatted <see cref="DateTime"/> from the given <paramref name="reader"/>. 18internal static unsafe DateTime ReadDateTime(this BinaryReader reader) 22/// Creates a <see cref="DateTime"/> object from raw data with validation. 25internal static DateTime CreateDateTimeFromData(long data) 45return Unsafe.As<long, DateTime>(ref data); 66if (typeof(T) == typeof(decimal) || typeof(T) == typeof(DateTime) || typeof(T) == typeof(TimeSpan)) 170else if (typeof(T) == typeof(DateTime)) 196/// <see langword="decimal"/>, <see cref="DateTime"/>, and <see cref="TimeSpan"/>. 207if (typeof(T) == typeof(DateTime) 325else if (typeof(T) == typeof(DateTime)) 327writer.Write((DateTime)(object)values[i]);
System\IO\BinaryWriterExtensions.cs (3)
13/// Writes a <see cref="DateTime"/> object to the given <paramref name="writer"/>. 15public static void Write(this BinaryWriter writer, DateTime value) 24long dateData = Unsafe.As<DateTime, long>(ref value);
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\BinaryFormat\Deserializer\ArrayRecordDeserializer.cs (2)
115SZArrayRecord<DateTime> primitiveArray => primitiveArray.GetArray(), 151|| elementType == typeof(DateTime) || elementType == typeof(TimeSpan);
System\Private\Windows\BinaryFormat\Serializer\Record.cs (1)
61writer.Write((DateTime)value);
System\Private\Windows\BinaryFormat\Support\FormatterConverterStub.cs (1)
30public DateTime ToDateTime(object value) => default;
System\Private\Windows\Nrbf\CoreNrbfSerializer.cs (6)
50{ TypeName.Parse(Types.DateTimeType), typeof(DateTime) }, 69{ Types.ToTypeName($"{Types.ListName}[[{Types.DateTimeType}]]"), typeof(List<DateTime>) }, 85{ Types.ToTypeName($"{Types.DateTimeType}[]"), typeof(DateTime[]) }, 118|| type == typeof(DateTime) 136|| type == typeof(List<DateTime>) 152|| type == typeof(DateTime[])
System\Private\Windows\Nrbf\SerializationRecordExtensions.cs (2)
354SZArrayRecord<DateTime> ar => ar.GetArray().CreateTrimmedList(size), 441SZArrayRecord<DateTime> ar => ar.GetArray(),
System\SpanReader.cs (1)
16/// correctly. For example, <see cref="DateTime"/> has a very specific set of valid values for its packed
System\Value.cs (17)
524public Value(DateTime value) 530public Value(DateTime? value) 543public static implicit operator Value(DateTime value) => new(value); 544public static explicit operator DateTime(in Value value) => value.GetValue<DateTime>(); 545public static implicit operator Value(DateTime? value) => new(value); 546public static explicit operator DateTime?(in Value value) => value.GetValue<DateTime?>(); 628if (typeof(T) == typeof(DateTime)) 629return new(Unsafe.As<T, DateTime>(ref Unsafe.AsRef(in value))); 659if (typeof(T) == typeof(DateTime?)) 660return new(Unsafe.As<T, DateTime?>(ref Unsafe.AsRef(in value))); 726else if (typeof(T) == typeof(DateTime) && _object == TypeFlags.DateTime) 728value = Unsafe.As<DateTime, T>(ref Unsafe.AsRef(in _union.DateTime)); 887else if (typeof(T) == typeof(DateTime?) && _object == TypeFlags.DateTime) 889DateTime? dateTime = _union.DateTime; 890value = Unsafe.As<DateTime?, T>(ref Unsafe.AsRef(in dateTime));
System\Value.TypeFlags.cs (2)
24internal static StraightCastFlag<DateTime> DateTime { get; } = StraightCastFlag<DateTime>.Instance;
System\Value.Union.cs (1)
36[FieldOffset(0)] public DateTime DateTime; // 8 bytes (ulong)
Windows\Win32\Foundation\FILETIME.cs (3)
8public FILETIME(DateTime date) 15public readonly DateTime ToDateTime() => DateTime.FromFileTime(((long)dwHighDateTime << 32) + dwLowDateTime);
Windows\Win32\System\Variant\VARIANT.cs (8)
156return DateTime.FromOADate(date); 365var result = GetSpan<DateTime>(array); 368result[i] = DateTime.FromOADate(data[i]); 582SetValue(array, DateTime.FromOADate(data), indices, lowerBounds); 665VT_DATE => typeof(DateTime), 800var result = new DateTime[data.Length]; 803result[i] = DateTime.FromOADate(data[i]); 812var result = new DateTime[data.Length];
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[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\MemoryWatch.cs (5)
33Value.Create((DateTime)default).GetValue<DateTime>(); 49Value.Create((DateTime?)default).GetValue<DateTime?>(); 66value.TryGetValue(out DateTime _);
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\BinaryXml\XmlBinaryReader.cs (4)
1148public override DateTime ReadContentAsDateTime() 1151DateTime value; 3286Type TypeOfDateTime = typeof(System.DateTime); 3765private DateTime ValueAsDateTime()
System\Xml\Core\XmlAsyncCheckReader.cs (3)
238public override DateTime ReadContentAsDateTime() 310public override DateTime ReadElementContentAsDateTime() 316public override DateTime ReadElementContentAsDateTime(string localName, string namespaceURI)
System\Xml\Core\XmlAsyncCheckWriter.cs (1)
272public override void WriteValue(DateTime value)
System\Xml\Core\XmlAutoDetectWriter.cs (1)
230public override void WriteValue(DateTime value)
System\Xml\Core\XmlReader.cs (4)
173public virtual DateTime ReadContentAsDateTime() 386public virtual DateTime ReadElementContentAsDateTime() 390DateTime value = ReadContentAsDateTime(); 400public virtual DateTime ReadElementContentAsDateTime(string localName, string namespaceURI)
System\Xml\Core\XmlSubtreeReader.cs (2)
689public override DateTime ReadContentAsDateTime() 694DateTime value = reader.ReadContentAsDateTime();
System\Xml\Core\XmlWellFormedWriter.cs (1)
1338public override void WriteValue(DateTime value)
System\Xml\Core\XmlWrappingWriter.cs (1)
171public override void WriteValue(DateTime value)
System\Xml\Core\XmlWriter.cs (1)
266public virtual void WriteValue(DateTime value)
System\Xml\Core\XsdValidatingReader.cs (2)
490public override DateTime ReadContentAsDateTime() 818public override DateTime ReadElementContentAsDateTime()
System\Xml\Schema\DataTypeImplementation.cs (8)
1998public override Type ValueType { get { return typeof(DateTime); } } 2000internal override Type ListValueType { get { return typeof(DateTime[]); } } 2020DateTime dateTime1 = (DateTime)value1; 2021DateTime dateTime2 = (DateTime)value2; 2045DateTime dateTimeValue; 2048dateTimeValue = (DateTime)dateTime;
System\Xml\Schema\FacetChecker.cs (9)
802internal virtual Exception? CheckValueFacets(DateTime value, XmlSchemaDatatype datatype) 1271DateTime dateTimeValue = datatype.ValueConverter.ToDateTime(value); 1275internal override Exception? CheckValueFacets(DateTime value, XmlSchemaDatatype datatype) 1282if (datatype.Compare(value, (DateTime)restriction!.MaxInclusive!) > 0) 1290if (datatype.Compare(value, (DateTime)restriction!.MaxExclusive!) >= 0) 1298if (datatype.Compare(value, (DateTime)restriction!.MinInclusive!) < 0) 1306if (datatype.Compare(value, (DateTime)restriction!.MinExclusive!) <= 0) 1328private static bool MatchEnumeration(DateTime value, ArrayList enumeration, XmlSchemaDatatype datatype) 1332if (datatype.Compare(value, (DateTime)enumeration[i]!) == 0)
System\Xml\Schema\XmlAtomicValue.cs (3)
37public DateTime dtVal; 90internal XmlAtomicValue(XmlSchemaType xmlType, DateTime value) 261public override DateTime ValueAsDateTime
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\CodeGenerator.cs (2)
831ConstructorInfo DateTime_ctor = typeof(DateTime).GetConstructor( 835Ldc(((DateTime)o).Ticks); // ticks
System\Xml\Serialization\PrimitiveXmlSerializers.cs (1)
110WriteElementStringRaw(@"dateTime", @"", FromDateTime(((System.DateTime)o)));
System\Xml\Serialization\ReflectionXmlSerializationWriter.cs (4)
1159else if (o is DateTime) 1163stringValue = FromDateTime((DateTime)o); 1168stringValue = FromDate((DateTime)o); 1173stringValue = FromTime((DateTime)o);
System\Xml\Serialization\Types.cs (6)
503AddPrimitive(typeof(DateTime), "dateTime", "DateTime", TypeFlags.CanBeAttributeValue | TypeFlags.CanBeElementValue | TypeFlags.HasCustomFormatter | TypeFlags.XmlEncodingNotRequired); 512AddPrimitive(typeof(DateTime), "date", "Date", TypeFlags.AmbiguousDataType | TypeFlags.CanBeAttributeValue | TypeFlags.CanBeElementValue | TypeFlags.HasCustomFormatter | TypeFlags.XmlEncodingNotRequired); 513AddPrimitive(typeof(DateTime), "time", "Time", TypeFlags.AmbiguousDataType | TypeFlags.CanBeAttributeValue | TypeFlags.CanBeElementValue | TypeFlags.HasCustomFormatter | TypeFlags.XmlEncodingNotRequired); 604AddSoapEncodedPrimitive(typeof(DateTime), "dateTime", ns, "DateTime", new XmlQualifiedName("string", XmlSchema.Namespace), TypeFlags.CanBeAttributeValue | TypeFlags.CanBeElementValue | TypeFlags.HasCustomFormatter | TypeFlags.XmlEncodingNotRequired); 613AddSoapEncodedPrimitive(typeof(DateTime), "date", ns, "Date", new XmlQualifiedName("string", XmlSchema.Namespace), TypeFlags.AmbiguousDataType | TypeFlags.CanBeAttributeValue | TypeFlags.CanBeElementValue | TypeFlags.HasCustomFormatter | TypeFlags.XmlEncodingNotRequired); 614AddSoapEncodedPrimitive(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) 83internal static string FromTime(DateTime value) 87return XmlConvert.ToString(DateTime.MinValue + value.TimeOfDay, "HH:mm:ss.fffffffZ"); 91return XmlConvert.ToString(DateTime.MinValue + value.TimeOfDay, "HH:mm:ss.fffffffzzzzzz"); 95internal static string FromDateTime(DateTime value) 108internal static bool TryFormatDateTime(DateTime value, Span<char> destination, out int charsWritten) 373internal static DateTime ToDateTime(string value) 386internal static DateTime ToDateTime(string value, string[] formats) 391internal static DateTime ToDate(string value) 396internal static DateTime ToTime(string value) 400return DateTime.ParseExact(value, s_allTimeFormats, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AllowLeadingWhite | DateTimeStyles.AllowTrailingWhite | DateTimeStyles.NoCurrentDateDefault | DateTimeStyles.RoundtripKind); 404return DateTime.ParseExact(value, s_allTimeFormats, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AllowLeadingWhite | DateTimeStyles.AllowTrailingWhite | DateTimeStyles.NoCurrentDateDefault);
System\Xml\Serialization\XmlSerializationReader.cs (12)
318return typeof(DateTime); 322return typeof(DateTime); 324return typeof(DateTime); 386return typeof(DateTime); 390return typeof(DateTime); 392return typeof(DateTime); 737value = default(Nullable<DateTime>); 741value = default(Nullable<DateTime>); 743value = default(Nullable<DateTime>); 1085protected static DateTime ToDateTime(string value) 1090protected static DateTime ToDate(string value) 1095protected static DateTime ToTime(string value)
System\Xml\Serialization\XmlSerializationWriter.cs (7)
123protected static string FromDateTime(DateTime value) 128internal static bool TryFormatDateTime(DateTime value, Span<char> destination, out int charsWritten) 133protected static string FromDate(DateTime value) 138protected static string FromTime(DateTime value) 305tryFormatResult = TryFormatDateTime((DateTime)o, _primitivesBuffer, out charsWritten); 4340else if (type == typeof(DateTime)) 4345Writer.Write(((DateTime)value).Ticks.ToString(CultureInfo.InvariantCulture));
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\XPath\XPathItem.cs (1)
30public abstract DateTime ValueAsDateTime { get; }
System\Xml\XPath\XPathNavigator.cs (1)
208public override DateTime ValueAsDateTime
System\Xml\Xsl\IlGen\GenerateHelper.cs (4)
136else if (storageType == typeof(DateTime)) 406public static readonly MethodInfo DTToStr = typeof(XsltConvert).GetMethod("ToString", new[] { typeof(DateTime) })!; 449{ typeof(DateTime), new XmlILStorageMethods(typeof(DateTime)) },
System\Xml\Xsl\IlGen\XmlILTrace.cs (1)
114w.WriteAttributeString("timestamp", DateTime.Now.ToString(CultureInfo.InvariantCulture));
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\Xml\Xsl\Runtime\XmlILStorageConverter.cs (1)
64public static XmlAtomicValue DateTimeToAtomicValue(DateTime value, int index, XmlQueryRuntime runtime)
System\Xml\Xsl\Runtime\XmlQueryRuntime.cs (5)
489if (destinationType == typeof(DateTime)) 582if (value.GetType() == typeof(DateTime)) 583value = XsltConvert.ToString((DateTime)value); 644if (sourceType == typeof(DateTime)) 645value = new XmlQueryItemSequence(new XmlAtomicValue(XmlSchemaType.GetBuiltInSimpleType(XmlTypeCode.String), XsltConvert.ToString((DateTime)value)));
System\Xml\Xsl\Runtime\XmlRawWriterWrapper.cs (1)
134public override void WriteValue(DateTime value)
System\Xml\Xsl\Runtime\XmlSortKey.cs (1)
365public XmlDateTimeSortKey(DateTime value, XmlCollation collation) : base(value.Ticks, collation)
System\Xml\Xsl\Runtime\XmlSortKeyAccumulator.cs (1)
65public void AddDateTimeSortKey(XmlCollation collation, DateTime value)
System\Xml\Xsl\Runtime\XsltConvert.cs (4)
200public static string ToString(DateTime value) 240public static DateTime ToDateTime(string value) 242return (DateTime)(new XsdDateTime(value, XsdDateTimeFlags.AllXsd)); 353if (clrType == typeof(DateTime)) return XmlQueryTypeFactory.StringX;
System\Xml\Xsl\Runtime\XsltFunctions.cs (4)
376DateTime dt = xdt.ToZulu(); 429DateTime dt; 549private static void PrintDate(char[] text, DateTime dt) 556private static void PrintTime(char[] text, DateTime dt)
System.Private.Xml.Linq (23)
System\Xml\Linq\XAttribute.cs (10)
538/// Cast the value of this <see cref="XAttribute"/> to a <see cref="DateTime"/>. 541/// The <see cref="XAttribute"/> to cast to <see cref="DateTime"/>. 544/// The content of this <see cref="XAttribute"/> as a <see cref="DateTime"/>. 550public static explicit operator DateTime(XAttribute attribute) 554return DateTime.Parse(attribute.value, CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.RoundtripKind); 558/// Cast the value of this <see cref="XAttribute"/> to a <see cref="DateTime"/>?. 561/// The <see cref="XAttribute"/> to cast to <see cref="DateTime"/>?. Can be null. 564/// The content of this <see cref="XAttribute"/> as a <see cref="DateTime"/>?. 568public static explicit operator DateTime?(XAttribute? attribute) 571return DateTime.Parse(attribute.value, CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.RoundtripKind);
System\Xml\Linq\XContainer.cs (1)
820DateTime dtValue => XmlConvert.ToString(dtValue, XmlDateTimeSerializationMode.RoundtripKind),
System\Xml\Linq\XElement.cs (12)
1692/// Cast the value of this <see cref="XElement"/> to a <see cref="DateTime"/>. 1695/// The <see cref="XElement"/> to cast to <see cref="DateTime"/>. 1698/// The content of this <see cref="XElement"/> as a <see cref="DateTime"/>. 1701/// Thrown if the specified element does not contain a valid <see cref="DateTime"/> value. 1707public static explicit operator DateTime(XElement element) 1711return DateTime.Parse(element.Value, CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.RoundtripKind); 1715/// Cast the value of this <see cref="XElement"/> to an <see cref="DateTime"/>?. 1718/// The <see cref="XElement"/> to cast to <see cref="DateTime"/>?. 1721/// The content of this <see cref="XElement"/> as a <see cref="DateTime"/>?. 1724/// Thrown if the specified element does not contain a valid <see cref="DateTime"/> value. 1728public static explicit operator DateTime?(XElement? element) 1731return DateTime.Parse(element.Value, CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.RoundtripKind);
System.Reflection.Metadata (4)
System\Reflection\Metadata\BlobBuilder.cs (1)
928public void WriteDateTime(DateTime value)
System\Reflection\Metadata\BlobContentId.cs (1)
122uint timestamp = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
System\Reflection\Metadata\BlobReader.cs (1)
363public DateTime ReadDateTime()
System\Reflection\Metadata\BlobWriter.cs (1)
343public void WriteDateTime(DateTime value)
System.Resources.Extensions (8)
src\libraries\Common\src\System\Resources\ResourceWriter.cs (2)
454else if (type == typeof(DateTime)) 564long data = ((DateTime)value!).ToBinary();
src\libraries\System.Private.CoreLib\src\System\Resources\ResourceReader.cs (2)
592else if (type == typeof(DateTime)) 696return DateTime.FromBinary(data);
System\Resources\Extensions\BinaryFormat\Deserializer\ArrayRecordDeserializer.cs (2)
118SZArrayRecord<DateTime> primitiveArray => primitiveArray.GetArray(), 155|| elementType == typeof(DateTime) || elementType == typeof(TimeSpan);
System\Resources\Extensions\PreserializedResourceWriter.cs (2)
55{ typeof(DateTime).FullName!, typeof(DateTime) },
System.Resources.Writer (2)
src\libraries\Common\src\System\Resources\ResourceWriter.cs (2)
454else if (type == typeof(DateTime)) 564long data = ((DateTime)value!).ToBinary();
System.Runtime (1)
artifacts\obj\System.Runtime\Debug\net10.0\System.Runtime.Forwards.cs (1)
123[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.DateTime))]
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\Caching\CacheMemoryMonitor.cs (4)
29private readonly DateTime[] _cacheSizeSampleTimes; 50_cacheSizeSampleTimes = new DateTime[SAMPLE_COUNT]; 176_cacheSizeSampleTimes[_idx] = DateTime.UtcNow; 207internal override int GetPercentToTrim(DateTime lastTrimTime, int lastTrimPercent)
System\Runtime\Caching\CacheUsage.cs (9)
93internal DateTime _utcDate; 332entries[entryIndex]._utcDate = DateTime.MinValue; 537entries[entryIndex]._utcDate = DateTime.UtcNow; 688DateTime utcDate; 705DateTime utcNow = DateTime.UtcNow; 723Debug.Assert(utcDate != DateTime.MinValue, "utcDate != DateTime.MinValue"); 748" underused items; Time=" + DateTime.Now.ToString("o", CultureInfo.InvariantCulture)); 807" underused items; Time=" + DateTime.Now.ToString("o", CultureInfo.InvariantCulture));
System\Runtime\Caching\MemoryCacheEntry.cs (11)
17private readonly DateTime _utcCreated; 20private DateTime _utcAbsExp; 27private DateTime _utcLastUpdateUsage; // time we last updated usage 47return _utcAbsExp < DateTime.MaxValue; 50internal DateTime UtcAbsExp 56internal DateTime UtcCreated 100internal DateTime UtcLastUpdateUsage 117_utcCreated = DateTime.UtcNow; 288internal void UpdateSlidingExp(DateTime utcNow, CacheExpires expires) 292DateTime utcNewExpires = utcNow + _slidingExp; 318internal void UpdateUsage(DateTime utcNow, CacheUsage usage)
System\Runtime\Caching\MemoryCacheEntryChangeMonitor.cs (4)
18private static readonly DateTime s_DATETIME_MINVALUE_UTC = new DateTime(0, DateTimeKind.Utc); 40DateTime utcCreated = s_DATETIME_MINVALUE_UTC; 56DateTime utcCreated = s_DATETIME_MINVALUE_UTC; 84private void StartMonitoring(MemoryCache cache, MemoryCacheEntry entry, ref bool hasChanged, ref DateTime utcCreated)
System\Runtime\Caching\MemoryCacheStatistics.cs (4)
31private DateTime _lastTrimTime; 211_lastTrimTime = DateTime.UtcNow; 261_lastTrimTime = DateTime.MinValue; 279Dbg.Trace("MemoryCacheStats", "**BEG** CacheManagerThread " + DateTime.Now.ToString("T", CultureInfo.InvariantCulture));
System\Runtime\Caching\MemoryCacheStore.cs (7)
64&& (!entry.HasExpiration() || entry.UtcAbsExp - DateTime.UtcNow >= CacheUsage.MIN_LIFETIME_FOR_USAGE)) 137DateTime utcNow = DateTime.UtcNow; 188if (existingEntry != null && existingEntry.UtcAbsExp <= DateTime.UtcNow) 235if (entry.UtcAbsExp > DateTime.UtcNow) 293if (entry != null && entry.UtcAbsExp <= DateTime.UtcNow) 358if (existingEntry.UtcAbsExp <= DateTime.UtcNow)
System\Runtime\Caching\MemoryMonitor.cs (2)
57internal abstract int GetPercentToTrim(DateTime lastTrimTime, int lastTrimPercent); 88+ " " + DateTime.Now.ToString("o", CultureInfo.InvariantCulture));
System\Runtime\Caching\PhysicalMemoryMonitor.cs (3)
78internal override int GetPercentToTrim(DateTime lastTrimTime, int lastTrimPercent) 85DateTime utcNow = DateTime.UtcNow;
System.Runtime.InteropServices (4)
System\Runtime\InteropServices\Marshalling\ComVariantMarshaller.cs (4)
68case DateTime dt: 160return unmanaged.As<DateTime>(); 197return DateTime.FromOADate(*(double*)unmanaged.GetRawDataRef<nint>()); 317case (VarEnum.VT_DATE, DateTime dt):
System.Runtime.InteropServices.JavaScript (4)
artifacts\obj\System.Runtime.InteropServices.JavaScript\Debug\net10.0\System.Runtime.InteropServices.JavaScript.notsupported.cs (4)
260public void ToManaged(out DateTime value) { throw new System.PlatformNotSupportedException(System.SR.SystemRuntimeInteropServicesJavaScript_PlatformNotSupported); } 261public void ToJS(DateTime value) { throw new System.PlatformNotSupportedException(System.SR.SystemRuntimeInteropServicesJavaScript_PlatformNotSupported); } 262public void ToManaged(out DateTime? value) { throw new System.PlatformNotSupportedException(System.SR.SystemRuntimeInteropServicesJavaScript_PlatformNotSupported); } 263public void ToJS(DateTime? value) { throw new System.PlatformNotSupportedException(System.SR.SystemRuntimeInteropServicesJavaScript_PlatformNotSupported); }
System.Runtime.Serialization.Formatters (3)
System\Runtime\Serialization\Formatter.cs (2)
76protected abstract void WriteDateTime(DateTime val, string name); 136else if (varType == typeof(DateTime))
System\Runtime\Serialization\FormatterConverter.cs (1)
120public DateTime ToDateTime(object value)
System.Security.Cryptography (84)
src\libraries\Common\src\Internal\Cryptography\PkcsHelpers.cs (2)
285public static byte[] EncodeUtcTime(DateTime utcTime) 314public static DateTime DecodeUtcTime(byte[] encodedUtcTime)
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.Crypto.cs (1)
152internal static void X509StoreSetVerifyTime(SafeX509StoreHandle ctx, DateTime verifyTime)
src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs9SigningTime.cs (8)
25: this(DateTime.Now) 29public Pkcs9SigningTime(DateTime signingTime) 49public DateTime SigningTime 65_lazySigningTime = default(DateTime?); 72private static DateTime Decode(byte[]? rawData) 75return default(DateTime); 80private static byte[] Encode(DateTime signingTime) 85private DateTime? _lazySigningTime;
System\Security\Cryptography\X509Certificates\Asn1\TimeAsn.manual.cs (1)
10DateTime utcValue = dateTimeOffset.UtcDateTime;
System\Security\Cryptography\X509Certificates\CertificateRequest.cs (2)
797DateTime notBeforeLocal = notBefore.LocalDateTime; 808DateTime notAfterLocal = notAfter.LocalDateTime;
System\Security\Cryptography\X509Certificates\ChainPal.cs (1)
22DateTime verificationTime,
System\Security\Cryptography\X509Certificates\ChainPal.OpenSsl.cs (2)
40DateTime verificationTime, 84DateTime verificationTime,
System\Security\Cryptography\X509Certificates\FindPal.cs (6)
102DateTime dateTime = ConfirmedCast<DateTime>(findValue); 108DateTime dateTime = ConfirmedCast<DateTime>(findValue); 114DateTime dateTime = ConfirmedCast<DateTime>(findValue);
System\Security\Cryptography\X509Certificates\ICertificatePalCore.cs (2)
23DateTime NotAfter { get; } 24DateTime NotBefore { get; }
System\Security\Cryptography\X509Certificates\IFindPal.cs (3)
18void FindByTimeValid(DateTime dateTime); 19void FindByTimeNotYetValid(DateTime dateTime); 20void FindByTimeExpired(DateTime dateTime);
System\Security\Cryptography\X509Certificates\ManagedCertificateFinder.cs (8)
113private static DateTime NormalizeDateTime(DateTime dateTime) 127public void FindByTimeValid(DateTime dateTime) 129DateTime normalized = NormalizeDateTime(dateTime); 134public void FindByTimeNotYetValid(DateTime dateTime) 136DateTime normalized = NormalizeDateTime(dateTime); 141public void FindByTimeExpired(DateTime dateTime) 143DateTime normalized = NormalizeDateTime(dateTime);
System\Security\Cryptography\X509Certificates\OpenSslCachedDirectoryStoreProvider.cs (1)
23private DateTime _loadLastWrite;
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\X509Certificates\OpenSslCrlCache.cs (5)
32DateTime verificationTime, 39verificationTime = DateTime.MinValue; 75private static bool AddCachedCrl(string crlFileName, SafeX509StoreHandle store, DateTime verificationTime) 97private static bool AddCachedCrlCore(string crlFile, SafeX509StoreHandle store, DateTime verificationTime) 133DateTime nextUpdate;
System\Security\Cryptography\X509Certificates\OpenSslX509CertificateReader.cs (5)
355public DateTime NotAfter 366public DateTime NotBefore 861internal static DateTime ExtractValidityDateTime(IntPtr validityDatePtr) 899if (DateTime.TryParseExact( 904out DateTime time))
System\Security\Cryptography\X509Certificates\OpenSslX509ChainEventSource.cs (3)
481internal void CrlCacheExpired(DateTime verificationTime, DateTime nextUpdate) 505internal void CrlCacheAcceptedFile(DateTime nextUpdate)
System\Security\Cryptography\X509Certificates\OpenSslX509ChainProcessor.cs (3)
49private readonly DateTime _verificationTime; 58DateTime verificationTime, 98DateTime verificationTime,
System\Security\Cryptography\X509Certificates\X509Certificate.cs (13)
27private DateTime _lazyNotBefore = DateTime.MinValue; 28private DateTime _lazyNotAfter = DateTime.MinValue; 40_lazyNotBefore = DateTime.MinValue; 41_lazyNotAfter = DateTime.MinValue; 696internal DateTime GetNotAfter() 700DateTime notAfter = _lazyNotAfter; 702if (notAfter == DateTime.MinValue) 710internal DateTime GetNotBefore() 714DateTime notBefore = _lazyNotBefore; 716if (notBefore == DateTime.MinValue) 737protected static string FormatDate(DateTime date)
System\Security\Cryptography\X509Certificates\X509Certificate2.cs (2)
308public DateTime NotAfter => GetNotAfter(); 309public DateTime NotBefore => GetNotBefore();
System\Security\Cryptography\X509Certificates\X509Chain.cs (1)
136chainPolicy.VerificationTimeIgnored ? DateTime.Now : chainPolicy.VerificationTime,
System\Security\Cryptography\X509Certificates\X509ChainPolicy.cs (3)
12private DateTime _verificationTime; 109public DateTime VerificationTime 132_verificationTime = DateTime.Now;
System.Security.Cryptography.Pkcs (15)
Internal\Cryptography\KeyAgreeRecipientInfoPal.cs (1)
19public abstract DateTime Date { get; }
Internal\Cryptography\Pal\AnyOS\ManagedPal.KeyAgree.cs (2)
37public override DateTime Date 51return DateTime.FromFileTimeUtc(0);
src\libraries\Common\src\Internal\Cryptography\PkcsHelpers.cs (2)
285public static byte[] EncodeUtcTime(DateTime utcTime) 314public static DateTime DecodeUtcTime(byte[] encodedUtcTime)
src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs9SigningTime.cs (8)
25: this(DateTime.Now) 29public Pkcs9SigningTime(DateTime signingTime) 49public DateTime SigningTime 65_lazySigningTime = default(DateTime?); 72private static DateTime Decode(byte[]? rawData) 75return default(DateTime); 80private static byte[] Encode(DateTime signingTime) 85private DateTime? _lazySigningTime;
System\Security\Cryptography\Pkcs\KeyAgreeRecipientInfo.cs (2)
59public DateTime Date 92private DateTime? _lazyDate;
System.ServiceModel.Federation (19)
System\Runtime\TimeoutHelper.cs (5)
15private DateTime _deadline; 22_deadline = DateTime.MaxValue; 114else if (_deadline == DateTime.MaxValue) 120TimeSpan remaining = _deadline - DateTime.UtcNow; 140_deadline = DateTime.UtcNow + OriginalTimeout;
System\ServiceModel\Federation\WSTrustChannelSecurityTokenProvider.cs (11)
68private DateTime AddTicks(DateTime time, long ticks) 70if (ticks > 0 && DateTime.MaxValue.Subtract(time).Ticks <= ticks) 71return DateTime.MaxValue; 73if (ticks < 0 && time.Subtract(DateTime.MinValue).Ticks <= -ticks) 74return DateTime.MinValue; 351DateTime fromTime = responseLifetime.Created?.ToUniversalTime() ?? DateTime.UtcNow; 352DateTime toTime = responseLifetime.Expires.Value.ToUniversalTime(); 356DateTime effectiveExpiration = AddTicks(fromTime, Math.Min(effectiveInterval, WSTrustTokenParameters.MaxIssuedTokenCachingTime.Ticks)); 358return effectiveExpiration < DateTime.UtcNow;
System\ServiceModel\Federation\WSTrustUtilities.cs (3)
152DateTime created = response.Lifetime?.Created ?? DateTime.UtcNow; 153DateTime expires = response.Lifetime?.Expires ?? created.AddDays(1);
System.ServiceModel.NetFramingBase (10)
System\ServiceModel\Channels\IdlingCommunicationPool.cs (10)
134_connectionMapping[connection].LastUsage = DateTime.UtcNow; 144DateTime now = DateTime.UtcNow; 238DateTime now = DateTime.UtcNow; 274private bool IdleOutConnection(TItem connection, DateTime now) 331private DateTime _lastUsage; 335CreationTime = DateTime.UtcNow; 339public DateTime CreationTime { get; } 341public DateTime LastUsage
System.ServiceModel.NetNamedPipe (7)
System\Runtime\BackoffTimeoutHelper.cs (7)
14private DateTime _deadline; 43_deadline = DateTime.MaxValue; 47_deadline = DateTime.UtcNow + timeout; 54if (_deadline == DateTime.MaxValue) 60return (DateTime.UtcNow >= _deadline); 89if (_deadline != DateTime.MaxValue) 91TimeSpan remainingTime = _deadline - DateTime.UtcNow;
System.ServiceModel.Primitives.Tests (8)
IdentityModel\SecurityTokenProviderTest.cs (2)
261public override DateTime ValidFrom => default; 262public override DateTime ValidTo => default;
ServiceModel\MessageContractTest.4.4.0.cs (4)
68Type = typeof(DateTime), 103Type = typeof(DateTime), 201request.transactionDate = DateTime.Now; 283request.transactionDate = DateTime.Now;
TestTypes.4.4.0.cs (2)
67public DateTime transactionDate; 100public DateTime transactionDate;
System.ServiceModel.UnixDomainSocket (6)
System\ServiceModel\Channels\SocketConnection.cs (6)
42private DateTime _lastReceiveTimeoutDeadline; 46private DateTime _lastSendTimeoutDeadline; 516_lastReceiveTimeoutDeadline = DateTime.UtcNow + timeout; 564_lastSendTimeoutDeadline = DateTime.UtcNow + timeout; 587private bool ShouldUpdateTimeout(DateTime oldTimeoutDeadline, TimeSpan newTimeout) 589var oldTimeout = oldTimeoutDeadline - DateTime.UtcNow;
System.Speech (1)
artifacts\obj\System.Speech\Debug\net10.0\System.Speech.notsupported.cs (1)
220public System.DateTime StartTime { get { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemSpeech); } }
System.Text.Json (94)
System\Text\Json\Document\JsonDocument.cs (2)
658internal bool TryGetValue(int index, out DateTime value) 683if (JsonHelpers.TryParseAsISO(segment, out DateTime tmp))
System\Text\Json\Document\JsonElement.cs (8)
1020/// Attempts to represent the current JSON string as a <see cref="DateTime"/>. 1027/// <see langword="true"/> if the string can be represented as a <see cref="DateTime"/>, 1036public bool TryGetDateTime(out DateTime value) 1044/// Gets the value of the element as a <see cref="DateTime"/>. 1049/// <returns>The value of the element as a <see cref="DateTime"/>.</returns> 1054/// The value cannot be represented as a <see cref="DateTime"/>. 1060public DateTime GetDateTime() 1062if (!TryGetDateTime(out DateTime value))
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\Nodes\JsonNode.Operators.cs (14)
53/// Defines an implicit conversion of a given <see cref="DateTime"/> to a <see cref="JsonNode"/>. 55/// <param name="value">A <see cref="DateTime"/> to implicitly convert.</param> 57public static implicit operator JsonNode(DateTime value) => JsonValue.Create(value); 60/// Defines an implicit conversion of a given <see cref="DateTime"/> to a <see cref="JsonNode"/>. 62/// <param name="value">A <see cref="DateTime"/> to implicitly convert.</param> 64public static implicit operator JsonNode?(DateTime? value) => JsonValue.Create(value); 293/// Defines an explicit conversion of a given <see cref="DateTime"/> to a <see cref="JsonNode"/>. 295/// <param name="value">A <see cref="DateTime"/> to explicitly convert.</param> 297public static explicit operator DateTime(JsonNode value) => value.GetValue<DateTime>(); 300/// Defines an explicit conversion of a given <see cref="DateTime"/> to a <see cref="JsonNode"/>. 302/// <param name="value">A <see cref="DateTime"/> to explicitly convert.</param> 304public static explicit operator DateTime?(JsonNode? value) => value?.GetValue<DateTime>();
System\Text\Json\Nodes\JsonValue.CreateOverloads.cs (4)
65public static JsonValue Create(DateTime value, JsonNodeOptions? options = null) => new JsonValuePrimitive<DateTime>(value, JsonMetadataServices.DateTimeConverter, options); 73public static JsonValue? Create(DateTime? value, JsonNodeOptions? options = null) => value.HasValue ? new JsonValuePrimitive<DateTime>(value.Value, JsonMetadataServices.DateTimeConverter, options) : null;
System\Text\Json\Nodes\JsonValueOfElement.cs (3)
150if (typeof(TypeToConvert) == typeof(DateTime) || typeof(TypeToConvert) == typeof(DateTime?)) 152success = Value.TryGetDateTime(out DateTime result);
System\Text\Json\Nodes\JsonValueOfT.cs (1)
92if (type == typeof(DateTime) || type == typeof(DateTimeOffset) || type == typeof(TimeSpan) ||
System\Text\Json\Reader\JsonReaderHelper.cs (2)
82public static bool TryGetEscapedDateTime(ReadOnlySpan<byte> source, out DateTime value) 94&& JsonHelpers.TryParseAsISO(sourceUnescaped, out DateTime tmp))
System\Text\Json\Reader\Utf8JsonReader.TryGet.cs (11)
719/// Parses the current JSON token value from the source as a <see cref="DateTime"/>. 720/// Returns the value if the entire UTF-8 encoded token value can be successfully parsed to a <see cref="DateTime"/> 731public DateTime GetDateTime() 733if (!TryGetDateTime(out DateTime value)) 741internal DateTime GetDateTimeNoValidation() 743if (!TryGetDateTimeCore(out DateTime value)) 1225/// Parses the current JSON token value from the source as a <see cref="DateTime"/>. 1227/// parsed to a <see cref="DateTime"/> value. 1234public bool TryGetDateTime(out DateTime value) 1244internal bool TryGetDateTimeCore(out DateTime value) 1279if (JsonHelpers.TryParseAsISO(span, out DateTime tmp))
System\Text\Json\Serialization\Converters\Value\DateTimeConverter.cs (5)
9internal sealed class DateTimeConverter : JsonPrimitiveConverter<DateTime> 11public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 16public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options) 21internal override DateTime ReadAsPropertyNameCore(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 27internal override void WriteAsPropertyNameCore(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options, bool isWritingExtensionDataProperty)
System\Text\Json\Serialization\Metadata\JsonMetadataServices.Converters.cs (3)
40/// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="DateTime"/> values. 43public static JsonConverter<DateTime> DateTimeConverter => s_dateTimeConverter ??= new DateTimeConverter(); 44private static JsonConverter<DateTime>? s_dateTimeConverter;
System\Text\Json\Serialization\Metadata\ReflectionEmitCachingMemberAccessor.Cache.cs (3)
26_lastEvictedTicks = DateTime.UtcNow.Ticks; 39long utcNowTicks = DateTime.UtcNow.Ticks; 62_lastEvictedTicks = DateTime.UtcNow.Ticks;
System\Text\Json\Writer\JsonWriterHelper.Date.cs (1)
15public static void WriteDateTimeTrimmed(Span<byte> buffer, DateTime value, out int bytesWritten)
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\Text\Json\Writer\Utf8JsonWriter.WriteValues.DateTime.cs (5)
13/// Writes the <see cref="DateTime"/> value (as a JSON string) as an element of a JSON array. 20/// Writes the <see cref="DateTime"/> using the round-trippable ('O') <see cref="StandardFormat"/> , for example: 2017-06-12T05:30:45.7680000. 22public void WriteStringValue(DateTime value) 42private void WriteStringValueMinimized(DateTime value) 66private void WriteStringValueIndented(DateTime value)
System.Transactions.Local (4)
System\Transactions\TransactionInformation.cs (1)
74public DateTime CreationTime => new DateTime(_internalTransaction.CreationTime);
System\Transactions\TransactionTable.cs (3)
215return DateTime.UtcNow.Ticks; 245_lastTimerTime = DateTime.UtcNow.Ticks; 405_lastTimerTime = DateTime.UtcNow.Ticks;
System.Windows.Forms (172)
System\Drawing\Design\UITypeEditor.cs (1)
39[typeof(DateTime)] = $"System.ComponentModel.Design.DateTimeEditor, {Assemblies.SystemDesign}",
System\Windows\Forms\ActiveX\AxHost.cs (3)
3812protected static double GetOADateFromTime(DateTime time) 3821protected static DateTime GetTimeFromOADate(double date) 3823return DateTime.FromOADate(date);
System\Windows\Forms\ActiveX\AxHost.TypeLibraryTimeStampAttribute.cs (2)
15Value = DateTime.Parse(timestamp, CultureInfo.InvariantCulture); 18public DateTime Value { get; }
System\Windows\Forms\ComponentModel\COM2Interop\COM2Properties.cs (3)
53_touchedTime = DateTime.Now.Ticks; 119public long TicksSinceTouched => _touchedTime == 0 ? 0 : DateTime.Now.Ticks - _touchedTime; 131_touchedTime = DateTime.Now.Ticks;
System\Windows\Forms\ComponentModel\COM2Interop\COM2TypeInfoProcessor.cs (1)
889VT_DATE => typeof(DateTime),
System\Windows\Forms\Controls\ComboBox\ComboBox.cs (6)
2027_autoCompleteTimeStamp = DateTime.Now.Ticks; 2042if (DateTime.Now.Ticks - _autoCompleteTimeStamp > AutoCompleteTimeout || 2059_autoCompleteTimeStamp = DateTime.Now.Ticks; 2074if (DateTime.Now.Ticks - _autoCompleteTimeStamp > AutoCompleteTimeout) 2083_autoCompleteTimeStamp = DateTime.Now.Ticks; 2100_autoCompleteTimeStamp = DateTime.Now.Ticks;
System\Windows\Forms\Controls\DataGridView\DataGridView.Methods.cs (2)
5779&& (DateTime.Now.Ticks - _lastMouseClickInfo.TimeStamp) / 10000 <= SystemInformation.DoubleClickTime 25401_lastMouseClickInfo.TimeStamp = DateTime.Now.Ticks;
System\Windows\Forms\Controls\DateTimePicker\DateTimePicker.cs (34)
64public static readonly DateTime MinDateTime = new(1753, 1, 1); 71public static readonly DateTime MaxDateTime = new(9998, 12, 31); 85private DateTime _value = DateTime.Now; 86private DateTime _creationTime = DateTime.Now; 88private DateTime _maxDateTime = DateTime.MaxValue; 89private DateTime _minDateTime = DateTime.MinValue; 557internal static DateTime EffectiveMinDate(DateTime minDate) 559DateTime minSupportedDate = MinimumDateTime; 572internal static DateTime EffectiveMaxDate(DateTime maxDate) 574DateTime maxSupportedDate = MaximumDateTime; 588public DateTime MaxDate 625public static DateTime MaximumDateTime 629DateTime maxSupportedDateTime = CultureInfo.CurrentCulture.Calendar.MaxSupportedDateTime; 644public DateTime MinDate 685public static DateTime MinimumDateTime 689DateTime minSupportedDateTime = CultureInfo.CurrentCulture.Calendar.MinSupportedDateTime; 835Value = DateTime.Parse(value, CultureInfo.CurrentCulture); 855public DateTime Value 864bool valueChanged = !DateTime.Equals(Value, value); 969_creationTime = DateTime.Now; 1007private static string FormatDateTime(DateTime value) 1250_value = DateTime.Now; 1315private void SetRange(DateTime min, DateTime max) 1405return _maxDateTime != MaximumDateTime && _maxDateTime != DateTime.MaxValue; 1413return _minDateTime != MinimumDateTime && _minDateTime != DateTime.MinValue; 1478DateTime temp = _value; 1483_value = (DateTime)nmdtc->st;
System\Windows\Forms\Controls\MonthCalendar\DateBoldEventArgs.cs (2)
12internal DateBoldEventArgs(DateTime start, int size) 18public DateTime StartDate { get; }
System\Windows\Forms\Controls\MonthCalendar\DateRangeEventArgs.cs (4)
12public DateRangeEventArgs(DateTime start, DateTime end) 18public DateTime Start { get; } 20public DateTime End { get; }
System\Windows\Forms\Controls\MonthCalendar\MonthCalendar.CalendarCellAccessibleObject.cs (1)
78DateTime cellDate = DateRange.Start;
System\Windows\Forms\Controls\MonthCalendar\MonthCalendar.CalendarRowAccessibleObject.cs (1)
167private string GetWeekNumber(DateTime date)
System\Windows\Forms\Controls\MonthCalendar\MonthCalendar.cs (70)
39/// of this, neither <see cref="AddBoldedDate(DateTime)"/> nor <see cref="RemoveBoldedDate(DateTime)"/> repaints the 100private DateTime _maxDate = DateTime.MaxValue; 101private DateTime _minDate = DateTime.MinValue; 104private DateTime _todaysDate = DateTime.Now.Date; 105private DateTime _selectionStart; 106private DateTime _selectionEnd; 107private DateTime _focusedDate; 123private readonly List<DateTime> _boldDates = []; 124private readonly List<DateTime> _annualBoldDates = []; 125private readonly List<DateTime> _monthlyBoldDates = []; 169public DateTime[] AnnuallyBoldedDates 184foreach (var dateTime in value) 248public DateTime[] BoldedDates 342DateTime currentDate = displayRange.Start; 450public DateTime MaxDate 506public DateTime MinDate 529public DateTime[] MonthlyBoldedDates 543foreach (var dateTime in value) 553private static DateTime Now => DateTime.Now.Date; 637public DateTime SelectionEnd 674public DateTime SelectionStart 855public DateTime TodayDate 869return ((DateTime)systemTime).Date; 876if (!_todayDateSet || (DateTime.Compare(value, _todaysDate) != 0)) 969public void AddAnnuallyBoldedDate(DateTime date) 979public void AddBoldedDate(DateTime date) 991public void AddMonthlyBoldedDate(DateTime date) 1089DateTime start = range.Start; 1094foreach (DateTime date in _boldDates) 1096if (DateTime.Compare(date, start) >= 0 && DateTime.Compare(date, range.End) <= 0) 1116private static bool CompareDayAndMonth(DateTime t1, DateTime t2) 1138private static string FormatDate(DateTime value) => value.ToString("d", CultureInfo.CurrentCulture); 1174private static int GetIndexInMonths(DateTime startDate, DateTime currentDate) 1196textExtent = screen.HDC.GetTextExtent(DateTime.Now.ToShortDateString(), hfont); 1259Start = (DateTime)times[0], 1260End = (DateTime)times[1] 1322return new HitTestInfo(mchi.pt, hitArea, (DateTime)systemTime); 1526public void RemoveAnnuallyBoldedDate(DateTime date) 1557public void RemoveBoldedDate(DateTime date) 1559DateTime toRemove = date.Date; 1562if (DateTime.Compare(_boldDates[i].Date, toRemove) == 0) 1577public void RemoveMonthlyBoldedDate(DateTime date) 1612private void ResetMaxDate() => MaxDate = DateTime.MaxValue; 1618private void ResetMinDate() => MinDate = DateTime.MinValue; 1703private void SetRange(DateTime minDate, DateTime maxDate) 1797public void SetDate(DateTime date) 1835public void SetSelectionRange(DateTime date1, DateTime date2) 1872private void SetSelRange(DateTime lower, DateTime upper) 1922=> _maxDate != DateTimePicker.MaximumDateTime && _maxDate != DateTime.MaxValue; 1928=> _minDate != DateTimePicker.MinimumDateTime && _minDate != DateTime.MinValue; 1934=> !DateTime.Equals(_selectionEnd, _selectionStart); 2044DateTime start = (DateTime)nmmcsc->stSelStart; 2045DateTime end = (DateTime)nmmcsc->stSelEnd; 2131DateTime start = _selectionStart = (DateTime)nmmcsc->stSelStart; 2132DateTime end = _selectionEnd = (DateTime)nmmcsc->stSelEnd;
System\Windows\Forms\Controls\MonthCalendar\MonthCalendar.HitTestInfo.cs (2)
15internal HitTestInfo(Point pt, HitArea area, DateTime time) 46public DateTime Time { get; }
System\Windows\Forms\Controls\MonthCalendar\MonthCalendar.MonthCalendarAccessibleObject.cs (14)
254return success ? new((DateTime)gridInfo.stStart, (DateTime)gridInfo.stEnd) : null; 319private CalendarCellAccessibleObject? GetCellByDate(DateTime date) 333DateTime calendarStart = calendar.DateRange.Start; 334DateTime calendarEnd = calendar.DateRange.End; 470internal DateTime MinDate => this.TryGetOwnerAs(out MonthCalendar? owner) ? owner.MinDate : DateTime.MinValue; 471internal DateTime MaxDate => this.TryGetOwnerAs(out MonthCalendar? owner) ? owner.MaxDate : DateTime.MaxValue; 550internal void SetSelectionRange(DateTime d1, DateTime d2) 562internal DateTime TodayDate => this.TryGetOwnerAs(out MonthCalendar? owner) ? owner.TodayDate : DateTime.Today; 580return DateTime.Equals(range.Start.Date, range.End.Date)
System\Windows\Forms\Controls\MonthCalendar\SelectionRange.cs (8)
17private DateTime _start = DateTime.MinValue.Date; 22private DateTime _end = DateTime.MaxValue.Date; 34public SelectionRange(DateTime lower, DateTime upper) 65public DateTime End 80public DateTime Start
System\Windows\Forms\Controls\MonthCalendar\SelectionRangeConverter.cs (12)
25if (sourceType == typeof(string) || sourceType == typeof(DateTime)) 39if (destinationType == typeof(InstanceDescriptor) || destinationType == typeof(DateTime)) 57return new SelectionRange(DateTime.Now.Date, DateTime.Now.Date); 62Span<DateTime> values = stackalloc DateTime[2]; 77else if (value is DateTime dt) 115if (destinationType == typeof(DateTime)) 124typeof(DateTime), typeof(DateTime) 145return new SelectionRange((DateTime)propertyValues["Start"]!, 146(DateTime)propertyValues["End"]!);
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\PropertyGridView.cs (2)
2599long timeStamp = DateTime.Now.Ticks; 3461_rowSelectTime = DateTime.Now.Ticks;
System\Windows\Forms\Controls\ToolStrips\ToolStripItem.cs (1)
2580long newTime = DateTime.Now.Ticks;
System\Windows\Forms\Controls\ToolStrips\ToolStripSplitButton.cs (1)
472long newTime = DateTime.Now.Ticks;
System\Windows\Forms\Controls\UpDown\NumericUpDown.cs (2)
565long nowTicks = DateTime.Now.Ticks; 636_buttonPressedStartTime = DateTime.Now.Ticks;
System.Windows.Forms.Design (57)
System\ComponentModel\Design\DateTimeEditor.cs (1)
11/// <see cref="DateTime"/> objects.
System\ComponentModel\Design\DateTimeEditor.DateTimeUI.cs (4)
29DateTime dateTime = (DateTime)value; 30_monthCalendar.SetDate(dateTime.Equals(DateTime.MinValue) ? DateTime.Today : dateTime);
System\Windows\Forms\Design\FormatControl.cs (4)
21private static readonly DateTime s_dateTimeFormatValue = DateTime.Now; 434private readonly DateTime _value; 436public DateTimeFormatsListBoxItem(DateTime value, string formatString)
System\Windows\Forms\Design\MaskDescriptorTemplate.cs (48)
73maskDescriptors.Add(new MaskDescriptorTemplate("00/00/0000", "Short date", "12112003", typeof(DateTime), culture)); 75maskDescriptors.Add(new MaskDescriptorTemplate("00/00/0000 90:00", "Short date and time (US)", "121120031120", typeof(DateTime), culture)); 79maskDescriptors.Add(new MaskDescriptorTemplate("90:00", "Time (US)", "1120", typeof(DateTime), culture)); 81maskDescriptors.Add(new MaskDescriptorTemplate("00:00", "Time (European/Military)", "2320", typeof(DateTime), culture)); 93maskDescriptors.Add(new MaskDescriptorTemplate("00 /00 /0000", "Short Date", "26102005", typeof(DateTime), culture)); 95maskDescriptors.Add(new MaskDescriptorTemplate("00 /00 /0000 00:00", "Short Date/Time", "261020051430", typeof(DateTime), culture)); 99maskDescriptors.Add(new MaskDescriptorTemplate("90:00", "Time", " 230", typeof(DateTime), culture)); 101maskDescriptors.Add(new MaskDescriptorTemplate("00:00", "Time (24 Hour)", "1430", typeof(DateTime), culture)); 107maskDescriptors.Add(new MaskDescriptorTemplate("00/00/0000", "Datum kurz", "28112005", typeof(DateTime), culture)); 109maskDescriptors.Add(new MaskDescriptorTemplate("00/00/0000 00:00", "Datum lang", "281120051430", typeof(DateTime), culture)); 111maskDescriptors.Add(new MaskDescriptorTemplate("90:00", "Zeit", "1430", typeof(DateTime), culture)); 125maskDescriptors.Add(new MaskDescriptorTemplate("00/00/0000", "Date (format court)", dateSample, typeof(DateTime), culture)); 127maskDescriptors.Add(new MaskDescriptorTemplate("00/00/0000 00:00", "Date et heure (format long)", dateSample + "1430", typeof(DateTime), culture)); 131maskDescriptors.Add(new MaskDescriptorTemplate("00:00", "Heure", "1430", typeof(DateTime), culture)); 145maskDescriptors.Add(new MaskDescriptorTemplate("00/00/0000", "Data breve", "26102005", typeof(DateTime), culture)); 147maskDescriptors.Add(new MaskDescriptorTemplate("00/00/0000 00:00", "Data e ora", "261020051430", typeof(DateTime), culture)); 149maskDescriptors.Add(new MaskDescriptorTemplate("00:00", "Ora", "1430", typeof(DateTime), culture)); 165maskDescriptors.Add(new MaskDescriptorTemplate("00/00/0000", "Fecha", "26102005", typeof(DateTime), culture)); 167maskDescriptors.Add(new MaskDescriptorTemplate("00/00/0000 00:00", "Fecha y hora", "261020051430", typeof(DateTime), culture)); 171maskDescriptors.Add(new MaskDescriptorTemplate("00:00", "Hora", "0830", typeof(DateTime), culture)); 185maskDescriptors.Add(new MaskDescriptorTemplate("0000/00/00", "日付(西暦)", "20050620", typeof(DateTime), culture)); 187maskDescriptors.Add(new MaskDescriptorTemplate("0000/00/00 00:00:00", "日付と時間(西暦)", "2005/06/11 04:33:22", typeof(DateTime), culture)); 189maskDescriptors.Add(new MaskDescriptorTemplate("90:00", "時間", " 633", typeof(DateTime), culture)); 193maskDescriptors.Add(new MaskDescriptorTemplate("0000年90月90日", "日付(西暦、日本語)", "2005年 6月11日", typeof(DateTime), culture)); 195maskDescriptors.Add(new MaskDescriptorTemplate("00/00/00", "日付(和暦)", "170611", typeof(DateTime), culture)); 197maskDescriptors.Add(new MaskDescriptorTemplate("AA90年90月90日", "日付(和暦、日本語)", "平成17年 6月11日", typeof(DateTime), culture)); 199maskDescriptors.Add(new MaskDescriptorTemplate("0000年90月90日 90時90分", "日付と時間(日本語)", "2005年 6月11日 3時33分", typeof(DateTime), culture)); 201maskDescriptors.Add(new MaskDescriptorTemplate("00/00/00 00:00:00", "日付と時間(和暦)", "170611043322", typeof(DateTime), culture)); 203maskDescriptors.Add(new MaskDescriptorTemplate("AA00年90月90日 90時90分", "日付と時間(和暦、日本語)", "平成17年 6月11日 3時33分", typeof(DateTime), culture)); 205maskDescriptors.Add(new MaskDescriptorTemplate("90時90分", "時間(日本語)", " 633", typeof(DateTime), culture)); 220maskDescriptors.Add(new MaskDescriptorTemplate("0000-00-00", "短日期格式", "20050611", typeof(DateTime), culture)); 222maskDescriptors.Add(new MaskDescriptorTemplate("0000年90月90日", "长日期格式", "20051211", typeof(DateTime), culture)); 224maskDescriptors.Add(new MaskDescriptorTemplate("0000-00-00 90:00:00", "短日期时间", "2005-06-11 6:30:22", typeof(DateTime), culture)); 226maskDescriptors.Add(new MaskDescriptorTemplate("0000年90月90日 90时00分", "长日期时间", "2005年 6月11日 6时33分", typeof(DateTime), culture)); 232maskDescriptors.Add(new MaskDescriptorTemplate("90:00", "时间格式", " 633", typeof(DateTime), culture)); 234maskDescriptors.Add(new MaskDescriptorTemplate("90时90分", "中文时间格式", " 6时33分", typeof(DateTime), culture)); 247maskDescriptors.Add(new MaskDescriptorTemplate("0000/00/00", "西曆簡短日期", "20050620", typeof(DateTime), culture)); 249maskDescriptors.Add(new MaskDescriptorTemplate("0000年90月90日", "西曆完整日期", "2005年10月 2日", typeof(DateTime), culture)); 251maskDescriptors.Add(new MaskDescriptorTemplate("0000/00/00 00:00:00", "西曆簡短日期時間", "20050611043322", typeof(DateTime), culture)); 253maskDescriptors.Add(new MaskDescriptorTemplate("0000年90月90日 90時90分", "西曆完整日期時間", "2005年 6月 2日 6時22分", typeof(DateTime), culture)); 257maskDescriptors.Add(new MaskDescriptorTemplate("90:00", "時間格式", " 633", typeof(DateTime), culture)); 259maskDescriptors.Add(new MaskDescriptorTemplate("90時90分", "中文時間格式", " 6時 3分", typeof(DateTime), culture)); 275maskDescriptors.Add(new MaskDescriptorTemplate("0000-00-00", "간단한 날짜", "20050620", typeof(DateTime), culture)); 277maskDescriptors.Add(new MaskDescriptorTemplate("0000-00-00 90:00", "간단한 날짜 및 시간", "2005-06-20 9:20", typeof(DateTime), culture)); 279maskDescriptors.Add(new MaskDescriptorTemplate("0000년90월90일 90시90분", "자세한 날짜 및 시간", "2005년 6월20일 6시33분", typeof(DateTime), culture)); 283maskDescriptors.Add(new MaskDescriptorTemplate("90:00", "시간", " 633", typeof(DateTime), culture)); 287maskDescriptors.Add(new MaskDescriptorTemplate("90시90분", "자세한 시간", " 6시33분", typeof(DateTime), culture)); 289maskDescriptors.Add(new MaskDescriptorTemplate("0000년 90월 90일", "자세한 날짜", "20050620", typeof(DateTime), culture));
System.Windows.Forms.Design.Tests (10)
EnsureEditorsTests.cs (1)
59[InlineData(typeof(DateTime), typeof(DateTimeEditor))]
System\Windows\Forms\Design\MaskDescriptorTests.cs (7)
96[InlineData("00/00/0000", "Date", "12/31/2000", typeof(DateTime), true)] 103Type type1 = typeof(DateTime); 117[InlineData("00/00/0000", "Date", "12/31/2000", typeof(DateTime), true, "Identical descriptors should produce the same hash code.")] 118[InlineData("000-00-0000", "SSN", "123-45-6789", typeof(DateTime), false, "Descriptors with different masks should produce different hash codes.")] 127Type type1 = typeof(DateTime); 161[InlineData("00/00/0000", "Date", "12/31/2000", typeof(DateTime), "System.Windows.Forms.Design.Tests.MaskDescriptorTests+ConcreteMaskDescriptor<Name=Date, Mask=00/00/0000, ValidatingType=System.DateTime")] 167[InlineData("00/00/0000", "Date", null, typeof(DateTime), "System.Windows.Forms.Design.Tests.MaskDescriptorTests+ConcreteMaskDescriptor<Name=Date, Mask=00/00/0000, ValidatingType=System.DateTime")]
System\Windows\Forms\Design\MaskDesignerDialogTests.cs (2)
37_dialog.TestAccessor().Dynamic._maskedTextBox.ValidatingType = typeof(DateTime); 40_dialog.ValidatingType.Should().Be(typeof(DateTime));
System.Windows.Forms.Primitives.Tests (42)
Interop\Kernel32\FILETIMETests.cs (1)
29DateTime dt = new DateTime(2020, 05, 13, 13, 3, 12, DateTimeKind.Utc).ToLocalTime();
Interop\Kernel32\SYSTEMTIMETests.cs (7)
46DateTime dt = (DateTime)st; // cast to DateTime implicitly 71DateTime dt; 73Assert.Throws<ArgumentOutOfRangeException>(() => dt = (DateTime)st); // cast to DateTime implicitly with incorrect arguments 80DateTime dt; 84dt = (DateTime)st; // cast to DateTime implicitly 87Assert.Equal(DateTime.MinValue, dt);
Interop\Oleaut32\VARIANTTests.cs (34)
720DateTime dt = new(2020, 05, 13, 13, 3, 12); 752DateTime dt = new DateTime(2020, 05, 13, 13, 3, 12, DateTimeKind.Utc).ToLocalTime(); 764DateTime dt = new(2020, 05, 13, 13, 3, 12); 791DateTime dt = new(2020, 05, 13, 13, 3, 12); 1674yield return new object[] { Array.Empty<double>(), Array.Empty<DateTime>() }; 1676DateTime d1 = new(2020, 05, 13, 13, 3, 12); 1677DateTime d2 = new(2020, 05, 13, 13, 3, 11); 1678DateTime d3 = new(2020, 3, 13, 13, 3, 12); 1679yield return new object[] { new double[] { d1.ToOADate(), d2.ToOADate(), d3.ToOADate() }, new DateTime[] { d1, d2, d3 } }; 1684public void VARIANT_ToObject_VECTORDATE_ReturnsExpected(double[] result, DateTime[] expected) 1710AssertToObjectEqualExtension<InvalidOleVariantTypeException>(Array.Empty<DateTime>(), variant); 1715yield return new object[] { Array.Empty<FILETIME>(), Array.Empty<DateTime>() }; 1717DateTime d1 = new(2020, 05, 13, 13, 3, 12); 1718DateTime d2 = new(2020, 05, 13, 13, 3, 11); 1719DateTime d3 = new(2020, 3, 13, 13, 3, 12); 1720yield return new object[] { new FILETIME[] { new(d1), new(d2), new(d3) }, new DateTime[] { d1, d2, d3 } }; 1725public void VARIANT_ToObject_VECTORFILETIME_ReturnsExpected(object result, DateTime[] expected) 1743AssertToObjectEqualExtension<InvalidOleVariantTypeException>(Array.Empty<DateTime>(), variant); 4249public void VARIANT_ToObject_ARRAYDATESingleDimension_ReturnsExpected(double[] result, DateTime[] expected) 4264Assert.IsType<DateTime[]>(array); 4274public void VARIANT_ToObject_ARRAYDATESingleDimensionNonZeroLowerBounds_ReturnsExpected(double[] result, DateTime[] expected) 4289Assert.IsType(typeof(DateTime).MakeArrayType(1), array); 4298yield return new object[] { new double[0, 0], new DateTime[0, 0] }; 4300DateTime d1 = new(2020, 05, 13, 13, 3, 12); 4301DateTime d2 = new(2020, 05, 13, 13, 3, 11); 4302DateTime d3 = new(2020, 3, 13, 13, 3, 12); 4303DateTime d4 = new(1892, 1, 2, 3, 4, 5, 6); 4304DateTime d5 = new(2010, 2, 3, 4, 5, 6); 4305DateTime d6 = new(8000, 10, 11, 12, 13, 14); 4313new DateTime[2, 3] 4323public void VARIANT_ToObject_ARRAYDATEMultiDimension_ReturnsExpected(double[,] result, DateTime[,] expected) 4338Assert.IsType(typeof(DateTime).MakeArrayType(2), array); 4350public void VARIANT_ToObject_ARRAYDATEMultiDimensionNonZeroLowerBound_ReturnsExpected(double[,] result, DateTime[,] expected) 4365Assert.IsType(typeof(DateTime).MakeArrayType(2), array);
System.Windows.Forms.Primitives.TestUtilities (1)
Metafiles\EmfValidateHelper.cs (1)
24string timestamp = DateTime.Now.ToString("yyyy/MM/dd HH:mm");
System.Windows.Forms.Tests (356)
System\Resources\ResxDataNodeTests.cs (2)
135{ DateTime.MinValue, DateTime.MaxValue },
System\Resources\ResXResourceWriterTests.cs (1)
17private readonly DateTime _testDateTime = new(2023, 5, 4);
System\Windows\Forms\AccessibleObjects\DateTimePicker.DateTimePickerAccessibleObjectTests.cs (1)
108DateTime dt = new(2000, 1, 1);
System\Windows\Forms\AccessibleObjects\MonthCalendar.CalendarTodayLinkAccessibleObjectTests.cs (1)
82DateTime.Today.ToShortDateString());
System\Windows\Forms\AccessibleObjects\MonthCalendar.MonthCalendarAccessibleObjectTests.cs (9)
83DateTime dt = new(2000, 1, 1); 110Assert.Equal(DateTime.Today, accessibleObject.TodayDate); 127yield return new object[] { DateTime.Today }; 132public void MonthCalendarAccessibleObject_MinDate_IsExpected(DateTime minDate) 144public void MonthCalendarAccessibleObject_MaxDate_IsExpected(DateTime maxDate) 265DateTime expectedTodayDate = new(2023, 1, 1); 312DateTime focusedDate = new(2023, 10, 1); 392calendar.SetDate(DateTime.Today); 395focusedCellAfterSetDate.DateRange.Start.Date.Should().Be(DateTime.Today);
System\Windows\Forms\AxHost.PropertyBagStreamTests.cs (1)
106DateTime.MaxValue,
System\Windows\Forms\BinaryFormat\WinFormsBinaryFormattedObjectTests.cs (1)
236new DateTime[] { default },
System\Windows\Forms\BindingSourceTests.cs (3)
723new Journal { IDate = DateTime.Now, Name = "A" }, 724new Journal { IDate = DateTime.Now.AddDays(-2), Name = "B" } 956public DateTime IDate { get; set; }
System\Windows\Forms\ClipboardTests.cs (3)
636TestData expected = new(DateTime.Now); 665public TestData(DateTime dateTime) 672private readonly DateTime _dateTime;
System\Windows\Forms\ComboBoxTests.cs (1)
2428Random random = new(DateTime.Now.Millisecond);
System\Windows\Forms\DataObjectExtensionsTests.cs (2)
100dataObject.TryGetData(DataFormats.SymbolicLink, Resolver, autoConvert, out DateTime? date).Should().BeFalse(); 134dataObject.TryGetData(DataFormats.SymbolicLink, Resolver, autoConvert, out DateTime? date).Should().BeFalse();
System\Windows\Forms\DateRangeEventArgsTests.cs (4)
13yield return new object[] { DateTime.MinValue, DateTime.MinValue }; 19public void Ctor_DateTime_DateTime(DateTime start, DateTime end)
System\Windows\Forms\DateTimePickerTests.cs (32)
121Assert.True(control.Value > DateTime.MinValue); 372DateTime expectedDate = new(2022, 12, 31); 376DateTime initialMaxDate = _dateTimePicker.MaxDate; 386Action act = () => _dateTimePicker.MaxDate = DateTime.Parse(value); 393DateTime maxSupportedDateTime = CultureInfo.CurrentCulture.Calendar.MaxSupportedDateTime; 394DateTime expectedDate = maxSupportedDateTime.Year > DateTimePicker.MaxDateTime.Year ? DateTimePicker.MaxDateTime : maxSupportedDateTime; 396DateTime result = DateTimePicker.MaximumDateTime; 406DateTime expectedDate = DateTimePicker.MinimumDateTime.AddDays(1); 425DateTime newMinDate = DateTimePicker.MinimumDateTime.AddDays(10); 435DateTime minSupportedDateTime = CultureInfo.CurrentCulture.Calendar.MinSupportedDateTime; 436DateTime expectedDate = minSupportedDateTime.Year < 1753 ? new(1753, 1, 1) : minSupportedDateTime; 440DateTime result = DateTimePicker.MinimumDateTime; 476_dateTimePicker.Text.Should().Be(DateTime.Parse(validDateString, CultureInfo.CurrentCulture).ToString("dddd, MMMM d, yyyy")); 479_dateTimePicker.Text.Should().Be(DateTime.Parse(DateTime.Now.Date.ToString(), CultureInfo.CurrentCulture).ToString("dddd, MMMM d, yyyy")); 482_dateTimePicker.Text.Should().Be(DateTime.Parse(DateTime.Now.Date.ToString(), CultureInfo.CurrentCulture).ToString("dddd, MMMM d, yyyy")); 488DateTime initialDate = new(2022, 1, 1); 489DateTime newDate = new(2023, 1, 1); 509Action act = () => _dateTimePicker.Value = DateTime.Parse(value); 657_dateTimePicker.Value = DateTime.Now; 661_dateTimePicker.Value = DateTime.Now.AddDays(1); 909DateTime dateTime = (DateTime)systemTime; 910Assert.Equal(DateTime.MinValue, dateTime); 918DateTime dt = new(2000, 1, 2, 3, 4, 5); 930DateTime dt = new(2000, 1, 2, 3, 4, 5); 943DateTime dt = new(2000, 1, 2, 3, 4, 5); 956DateTime dt = new(2000, 1, 2, 3, 4, 5); 970DateTime dt = new(2000, 1, 2, 3, 4, 5); 984DateTime dt = new(2000, 1, 2, 3, 4, 5); 998DateTime dt = new(2000, 1, 2, 3, 4, 5);
System\Windows\Forms\MonthCalendar.DateBoldEventArgsTests.cs (6)
10public static readonly TheoryData<DateTime, int> s_dateBoldEventArgs_Constructor_InitializesPropertiesCorrectly_Data = new() 12{ DateTime.UtcNow, 5 }, 13{ DateTime.UtcNow.AddDays(-1), 10 }, 14{ DateTime.UtcNow.AddDays(1), 0 } 19public void DateBoldEventArgs_Constructor_InitializesPropertiesCorrectly(DateTime startDate, int size) 39DateBoldEventArgs eventArgs = new(DateTime.UtcNow, 5)
System\Windows\Forms\MonthCalendar.HitTestInfoTests.cs (4)
20DateTime? time = hasDateTime ? DateTime.Parse(dateTimeStr) : null; 28hitTestInfo.Time.Should().Be(time ?? DateTime.MinValue); 44public void HitTestInfo_Constructor_WithNullDateTime_ThrowsException(DateTime? time)
System\Windows\Forms\MonthCalendar.SelectionRangeConverterTests.cs (14)
32[InlineData(typeof(DateTime), true)] 41[InlineData(typeof(DateTime), true)] 61range.Start.Should().Be(DateTime.Parse(expectedStart)); 62range.End.Should().Be(DateTime.Parse(expectedEnd)); 68DateTime value = new(2022, 1, 1); 87{ "2022-01-01", typeof(DateTime), new DateTime(2022, 1, 1) } 95DateTime start = DateTime.Parse(dates[0]); 96DateTime end = dates.Length > 1 ? DateTime.Parse(dates[1]) : start; 135if (startDate is not DateTime startTime || endDate is not DateTime endTime) 156SelectionRange range = new SelectionRange(DateTime.Now, DateTime.Now.AddDays(1));
System\Windows\Forms\MonthCalendarTests.cs (270)
116Assert.Equal(DateTime.Now.Date, control.SelectionEnd); 117Assert.Equal(DateTime.Now.Date, control.SelectionRange.Start); 118Assert.Equal(DateTime.Now.Date, control.SelectionRange.End); 120Assert.Equal(DateTime.Now.Date, control.SelectionStart); 135Assert.Equal(DateTime.Now.Date, control.TodayDate); 169yield return new object[] { null, Array.Empty<DateTime>() }; 170yield return new object[] { Array.Empty<DateTime>(), Array.Empty<DateTime>() }; 172yield return new object[] { new DateTime[] { new(2019, 01, 1), new(2019, 01, 20) }, new DateTime[] { new(2019, 01, 1), new(2019, 01, 20) } }; 173yield return new object[] { new DateTime[] { new(2017, 01, 1), new(2018, 01, 20) }, new DateTime[] { new(2017, 01, 1), new(2018, 01, 20) } }; 174yield return new object[] { new DateTime[] { new(2019, 01, 1), new(2019, 01, 1), new(2018, 01, 1) }, new DateTime[] { new(2019, 01, 1), new(2019, 01, 1), new(2018, 01, 1) } }; 175yield return new object[] { new DateTime[] { DateTime.MinValue, DateTime.MaxValue }, new DateTime[] { DateTime.MinValue, DateTime.MaxValue } }; 177var everyMonth = new DateTime[] 197public void MonthCalendar_AnnuallyBoldedDates_Set_GetReturnsExpected(DateTime[] value, DateTime[] expected) 234public void MonthCalendar_AnnuallyBoldedDates_SetWithHandle_GetReturnsExpected(DateTime[] value, DateTime[] expected) 497yield return new object[] { null, Array.Empty<DateTime>() }; 498yield return new object[] { Array.Empty<DateTime>(), Array.Empty<DateTime>() }; 500yield return new object[] { new DateTime[] { new(2019, 01, 1), new(2019, 01, 20) }, new DateTime[] { new(2019, 01, 1), new(2019, 01, 20) } }; 501yield return new object[] { new DateTime[] { new(2017, 01, 1), new(2018, 01, 20) }, new DateTime[] { new(2017, 01, 1), new(2018, 01, 20) } }; 502yield return new object[] { new DateTime[] { new(2019, 01, 1), new(2019, 01, 1), new(2018, 01, 1) }, new DateTime[] { new(2019, 01, 1), new(2019, 01, 1), new(2018, 01, 1) } }; 503yield return new object[] { new DateTime[] { DateTime.MinValue, DateTime.MaxValue }, new DateTime[] { DateTime.MinValue, DateTime.MaxValue } }; 505var everyMonth = new DateTime[] 525public void MonthCalendar_BoldedDates_Set_GetReturnsExpected(DateTime[] value, DateTime[] expected) 562public void MonthCalendar_BoldedDates_SetWithHandle_GetReturnsExpected(DateTime[] value, DateTime[] expected) 1023DateTime lower = new(2019, 1, 30, 3, 4, 5, 6); 1024DateTime upper = new(2019, 2, 3, 4, 5, 6, 7); 1315yield return new object[] { new DateTime(9998, 12, 31), new DateTime(9998, 12, 31), DateTime.Now.Date }; 1316yield return new object[] { new DateTime(9999, 1, 1), new DateTime(9998, 12, 31), DateTime.Now.Date }; 1317yield return new object[] { DateTime.MaxValue, new DateTime(9998, 12, 31), DateTime.Now.Date }; 1322public void MonthCalendar_MaxDate_Set_GetReturnsExpected(DateTime value, DateTime expected, DateTime expectedSelection) 1343public void MonthCalendar_MaxDate_SetWithHandle_GetReturnsExpected(DateTime value, DateTime expected, DateTime expectedSelection) 1447yield return new object[] { DateTime.MinValue, new DateTime(1753, 1, 1), DateTime.Now.Date }; 1448yield return new object[] { new DateTime(1753, 1, 1), new DateTime(1753, 1, 1), DateTime.Now.Date }; 1449yield return new object[] { new DateTime(2019, 1, 29), new DateTime(2019, 1, 29), DateTime.Now.Date }; 1455public void MonthCalendar_MinDate_Set_GetReturnsExpected(DateTime value, DateTime expected, DateTime expectedSelection) 1476public void MonthCalendar_MinDate_SetWithHandle_GetReturnsExpected(DateTime value, DateTime expected, DateTime expectedSelection) 1523yield return new object[] { null, Array.Empty<DateTime>() }; 1524yield return new object[] { Array.Empty<DateTime>(), Array.Empty<DateTime>() }; 1526yield return new object[] { new DateTime[] { new(2019, 01, 1), new(2019, 01, 20) }, new DateTime[] { new(2019, 01, 1), new(2019, 01, 20) } }; 1527yield return new object[] { new DateTime[] { new(2017, 01, 1), new(2018, 01, 20) }, new DateTime[] { new(2017, 01, 1), new(2018, 01, 20) } }; 1528yield return new object[] { new DateTime[] { new(2019, 01, 1), new(2019, 01, 1), new(2018, 01, 1) }, new DateTime[] { new(2019, 01, 1), new(2019, 01, 1), new(2018, 01, 1) } }; 1529yield return new object[] { new DateTime[] { DateTime.MinValue, DateTime.MaxValue }, new DateTime[] { DateTime.MinValue, DateTime.MaxValue } }; 1531var everyMonth = new DateTime[] 1551public void MonthCalendar_MonthlyBoldedDates_Set_GetReturnsExpected(DateTime[] value, DateTime[] expected) 1588public void MonthCalendar_MonthlyBoldedDates_SetWithHandle_GetReturnsExpected(DateTime[] value, DateTime[] expected) 1945yield return new object[] { DateTime.MinValue, new DateTime(1, 1, 7) }; 1949yield return new object[] { DateTime.Now.Date.AddDays(-1), DateTime.Now.Date }; 1950yield return new object[] { DateTime.Now.Date, DateTime.Now.Date }; 1952yield return new object[] { DateTime.MaxValue, DateTime.MaxValue }; 1957public void MonthCalendar_SelectionStart_Set_GetReturnsExpected(DateTime value, DateTime expectedSelectionEnd) 1976public void MonthCalendar_SelectionStart_SetWithHandle_GetReturnsExpected(DateTime value, DateTime expectedSelectionEnd) 2032yield return new object[] { DateTime.Now.Date.AddDays(1), DateTime.Now.Date }; 2033yield return new object[] { DateTime.Now.Date, DateTime.Now.Date }; 2039public void MonthCalendar_SelectionEnd_Set_GetReturnsExpected(DateTime value, DateTime expectedSelectionStart) 2058public void MonthCalendar_SelectionEnd_SetWithHandle_GetReturnsExpected(DateTime value, DateTime expectedSelectionStart) 2109yield return new object[] { new SelectionRange(DateTime.MinValue, DateTime.MinValue), DateTime.MinValue, DateTime.MinValue }; 2121yield return new object[] { new SelectionRange(DateTime.Now.Date, DateTime.Now.Date), DateTime.Now.Date, DateTime.Now.Date }; 2122yield return new object[] { new SelectionRange(DateTime.Now.Date, DateTime.Now.Date.AddDays(1)), DateTime.Now.Date, DateTime.Now.Date.AddDays(1) }; 2123yield return new object[] { new SelectionRange(DateTime.Now.Date.AddHours(1), DateTime.Now.Date.AddHours(1)), DateTime.Now.Date, DateTime.Now.Date }; 2124yield return new object[] { new SelectionRange(DateTime.Now.Date.AddDays(1), DateTime.Now.Date), DateTime.Now.Date, DateTime.Now.Date.AddDays(1) }; 2125yield return new object[] { new SelectionRange(DateTime.Now.Date, DateTime.Now.Date.AddDays(6)), DateTime.Now.Date, DateTime.Now.Date.AddDays(6) }; 2126yield return new object[] { new SelectionRange(DateTime.Now.Date, DateTime.Now.Date.AddDays(7)), DateTime.Now.Date.AddDays(1), DateTime.Now.Date.AddDays(7) }; 2131yield return new object[] { new SelectionRange(DateTime.MaxValue, DateTime.MaxValue), DateTime.MaxValue.Date, DateTime.MaxValue.Date }; 2136public void MonthCalendar_SelectionRange_Set_GetReturnsExpected(SelectionRange value, DateTime expectedSelectionStart, DateTime expectedSelectionEnd) 2161public void MonthCalendar_SelectionRange_SetWithHandle_GetReturnsExpected(SelectionRange value, DateTime expectedSelectionStart, DateTime expectedSelectionEnd) 2837Assert.Equal(DateTime.Now.Date, control.TodayDate); 2843yield return new object[] { DateTime.MinValue }; 2848yield return new object[] { DateTime.Now.Date }; 2849yield return new object[] { DateTime.Now.Date.AddHours(1) }; 2852yield return new object[] { DateTime.MaxValue }; 2857public void MonthCalendar_TodayDate_Set_GetReturnsExpected(DateTime value) 2876public void MonthCalendar_TodayDate_SetWithHandle_GetReturnsExpected(DateTime value) 3015calendar.AddAnnuallyBoldedDate(DateTime.MinValue); 3016Assert.Equal(new DateTime[] { new(2019, 10, 3), new(2019, 10, 5), new(2019, 09, 5), new(2018, 09, 5), new(2018, 09, 5), DateTime.MinValue }, calendar.AnnuallyBoldedDates); 3020calendar.AddAnnuallyBoldedDate(DateTime.MaxValue); 3021Assert.Equal(new DateTime[] { new(2019, 10, 3), new(2019, 10, 5), new(2019, 09, 5), new(2018, 09, 5), new(2018, 09, 5), DateTime.MinValue, DateTime.MaxValue }, calendar.AnnuallyBoldedDates); 3077calendar.AddAnnuallyBoldedDate(DateTime.MinValue); 3078Assert.Equal(new DateTime[] { new(2019, 10, 3), new(2019, 10, 5), new(2019, 09, 5), new(2018, 09, 5), new(2018, 09, 5), DateTime.MinValue }, calendar.AnnuallyBoldedDates); 3085calendar.AddAnnuallyBoldedDate(DateTime.MaxValue); 3086Assert.Equal(new DateTime[] { new(2019, 10, 3), new(2019, 10, 5), new(2019, 09, 5), new(2018, 09, 5), new(2018, 09, 5), DateTime.MinValue, DateTime.MaxValue }, calendar.AnnuallyBoldedDates); 3122calendar.AddBoldedDate(DateTime.MinValue); 3123Assert.Equal(new DateTime[] { new(2019, 10, 3), new(2019, 10, 5), new(2019, 09, 5), new(2018, 09, 5), DateTime.MinValue }, calendar.BoldedDates); 3127calendar.AddBoldedDate(DateTime.MaxValue); 3128Assert.Equal(new DateTime[] { new(2019, 10, 3), new(2019, 10, 5), new(2019, 09, 5), new(2018, 09, 5), DateTime.MinValue, DateTime.MaxValue }, calendar.BoldedDates); 3184calendar.AddBoldedDate(DateTime.MinValue); 3185Assert.Equal(new DateTime[] { new(2019, 10, 3), new(2019, 10, 5), new(2019, 09, 5), new(2018, 09, 5), DateTime.MinValue }, calendar.BoldedDates); 3192calendar.AddBoldedDate(DateTime.MaxValue); 3193Assert.Equal(new DateTime[] { new(2019, 10, 3), new(2019, 10, 5), new(2019, 09, 5), new(2018, 09, 5), DateTime.MinValue, DateTime.MaxValue }, calendar.BoldedDates); 3229calendar.AddMonthlyBoldedDate(DateTime.MinValue); 3230Assert.Equal(new DateTime[] { new(2019, 10, 3), new(2019, 10, 5), new(2019, 09, 5), new(2018, 09, 5), new(2018, 09, 5), DateTime.MinValue }, calendar.MonthlyBoldedDates); 3234calendar.AddMonthlyBoldedDate(DateTime.MaxValue); 3235Assert.Equal(new DateTime[] { new(2019, 10, 3), new(2019, 10, 5), new(2019, 09, 5), new(2018, 09, 5), new(2018, 09, 5), DateTime.MinValue, DateTime.MaxValue }, calendar.MonthlyBoldedDates); 3291calendar.AddMonthlyBoldedDate(DateTime.MinValue); 3292Assert.Equal(new DateTime[] { new(2019, 10, 3), new(2019, 10, 5), new(2019, 09, 5), new(2018, 09, 5), new(2018, 09, 5), DateTime.MinValue }, calendar.MonthlyBoldedDates); 3299calendar.AddMonthlyBoldedDate(DateTime.MaxValue); 3300Assert.Equal(new DateTime[] { new(2019, 10, 3), new(2019, 10, 5), new(2019, 09, 5), new(2018, 09, 5), new(2018, 09, 5), DateTime.MinValue, DateTime.MaxValue }, calendar.MonthlyBoldedDates); 3459yield return new object[] { new DateRangeEventArgs(DateTime.Now, DateTime.Now) }; 3952yield return new object[] { DateTime.MinValue }; 3957yield return new object[] { DateTime.Now.Date }; 3958yield return new object[] { DateTime.Now.Date.AddHours(1) }; 3961yield return new object[] { DateTime.MaxValue }; 3966public void MonthCalendar_SetDate_Invoke_GetReturnsExpected(DateTime date) 3987public void MonthCalendar_SetDate_InvokeWithHandle_GetReturnsExpected(DateTime date) 4046yield return new object[] { DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue }; 4058yield return new object[] { DateTime.Now.Date, DateTime.Now.Date, DateTime.Now.Date, DateTime.Now.Date }; 4059yield return new object[] { DateTime.Now.Date, DateTime.Now.Date.AddDays(1), DateTime.Now.Date, DateTime.Now.Date.AddDays(1) }; 4060yield return new object[] { DateTime.Now.Date.AddHours(1), DateTime.Now.Date.AddHours(1), DateTime.Now.Date.AddHours(1), DateTime.Now.Date.AddHours(1) }; 4061yield return new object[] { DateTime.Now.Date.AddDays(1), DateTime.Now.Date, DateTime.Now.Date.AddDays(1), DateTime.Now.Date.AddDays(1) }; 4062yield return new object[] { DateTime.Now.Date, DateTime.Now.Date.AddDays(6), DateTime.Now.Date, DateTime.Now.Date.AddDays(6) }; 4063yield return new object[] { DateTime.Now.Date, DateTime.Now.Date.AddDays(7), DateTime.Now.Date.AddDays(1), DateTime.Now.Date.AddDays(7) }; 4068yield return new object[] { DateTime.MaxValue, DateTime.MaxValue, DateTime.MaxValue, DateTime.MaxValue }; 4073public void MonthCalendar_SetSelectionRange_Invoke_GetReturnsExpected(DateTime date1, DateTime date2, DateTime expectedSelectionStart, DateTime expectedSelectionEnd) 4094public void MonthCalendar_SetSelectionRange_InvokeWithHandle_GetReturnsExpected(DateTime date1, DateTime date2, DateTime expectedSelectionStart, DateTime expectedSelectionEnd) 4186public unsafe void MonthCalendar_FillMonthDayStates_ReturnsExpected(DateTime currentDate) 4238public unsafe void MonthCalendar_GetIndexInMonths_ReturnsExpected(DateTime currentDate, int expectedIndex) 4240DateTime startDate = new(2021, 8, 1); 4250DateTime startDate = new(2023, 1, 1); 4251DateTime endDate = new(2023, 12, 31); 4386DateTime startDate = new(2022, 10, 1); 4387DateTime endDate = new(2022, 10, 7); 4436DateTime expectedStart = cellAccessibleObject.DateRange.Start; 4437DateTime expectedEnd = cellAccessibleObject.DateRange.End; 4482((DateTime[])typeof(MonthCalendar).GetProperty(propertyName).GetValue(calendar)).Length.Should().Be(expectedCount); 4498DateTime? expectedTime = expectedTimeString is null ? null : DateTime.Parse(expectedTimeString); 4502hitTestInfo.Time.Should().NotBe(DateTime.MinValue); 4514calendar.MaxDate = DateTime.MaxValue; 4516ShouldSerializeProperty(() => calendar.TestAccessor().Dynamic.ShouldSerializeTodayDate(), () => calendar.TodayDate = DateTime.Now); 4517ShouldSerializeProperty(() => calendar.TestAccessor().Dynamic.ShouldSerializeAnnuallyBoldedDates(), () => calendar.AddAnnuallyBoldedDate(DateTime.Now)); 4518ShouldSerializeProperty(() => calendar.TestAccessor().Dynamic.ShouldSerializeBoldedDates(), () => calendar.AddBoldedDate(DateTime.Now)); 4519ShouldSerializeProperty(() => calendar.TestAccessor().Dynamic.ShouldSerializeMonthlyBoldedDates(), () => calendar.AddMonthlyBoldedDate(DateTime.Now)); 4520ShouldSerializeProperty(() => calendar.TestAccessor().Dynamic.ShouldSerializeMaxDate(), () => calendar.MaxDate = DateTime.Now.AddYears(2)); 4521ShouldSerializeProperty(() => calendar.TestAccessor().Dynamic.ShouldSerializeMinDate(), () => calendar.MinDate = DateTime.Now); 4550DateTime todayDateBeforeReset = calendar.TodayDate; 4552DateTime todayDateAfterReset = calendar.TodayDate; 4555todayDateAfterReset.Should().Be(DateTime.Today); 4569DateTime todayDateBeforeReset = calendar.TodayDate; 4571DateTime todayDateAfterReset = calendar.TodayDate; 4638DateTime originalDate = DateTime.Now.Date; 4657DateTime.Now, 4658DateTime.MinValue, 4689calendar.AddAnnuallyBoldedDate(DateTime.Now); 4700calendar.AddBoldedDate(DateTime.Now);
System\Windows\Forms\PropertyStoreTests.cs (1)
183store.AddValue(1, DateTime.Now);
System.Windows.Forms.UI.IntegrationTests (11)
MonthCalendarTests.cs (11)
13private static readonly DateTime s_currentDate = new(2021, 12, 1); 14private static readonly DateTime s_maxDate = new(2021, 12, 3, 18, 0, 0); 15private static readonly DateTime s_minDate = new(2021, 11, 30, 17, 0, 0); 58DateTime selectedDate = new(2020, 4, 10); 89DateTime newDate = s_currentDate.Date.AddDays(delta); 111DateTime newDate = s_currentDate.Date.AddDays(delta); 131DateTime givenDate = new(givenYear, givenMonth, givenDay); 132DateTime expectedDate = new(expectedYear, expectedMonth, expectedDay); 174private Point GetCellPositionByDate(MonthCalendar calendar, DateTime dateTime) 181private async Task ClickOnDateAsync(Form form, MonthCalendar calendar, DateTime date) 189private async Task ClickOnDateTwiceAsync(Form form, MonthCalendar calendar, DateTime date)
System.Xaml (10)
src\Microsoft.DotNet.Wpf\src\Shared\System\Windows\Markup\TypeConverterHelper.cs (2)
319else if (type == typeof(DateTime)) 419else if (typeof(DateTime).IsAssignableFrom(type))
System\Windows\Markup\DateTimeValueSerializer.cs (6)
32public override bool CanConvertToString(object? value, IValueSerializerContext? context) => value is DateTime; 35/// Converts the given value object to a <see cref="DateTime" />. 46return DateTime.MinValue; 54return DateTime.Parse(value, DateTimeFormatInfo.InvariantInfo, DateTimeStyles); 58/// Converts the given value object to a <see cref="DateTime" /> using the arguments. 62if (value is not DateTime dateTime)
System\Xaml\Replacements\DateTimeConverter2.cs (1)
42if (destinationType == typeof(string) && value is DateTime)
System\Xaml\Schema\BuiltInValueConverter.cs (1)
167if (typeof(DateTime) == targetType)
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\Windows\Markup\ValueSerializerTests.cs (6)
135Assert.IsType<DateTimeValueSerializer>(ValueSerializer.GetSerializerFor(typeof(DateTime))); 136Assert.IsType<DateTimeValueSerializer>(ValueSerializer.GetSerializerFor(typeof(DateTime), null)); 220Assert.IsType<DateTimeValueSerializer>(ValueSerializer.GetSerializerFor(typeof(DateTime))); 221TypeDescriptor.Refresh(typeof(DateTime)); 222Assert.IsType<DateTimeValueSerializer>(ValueSerializer.GetSerializerFor(typeof(DateTime))); 393public DateTime Property { get; set; }
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)
Program.cs (1)
28DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
UIAutomationClient (10)
System\Windows\Automation\RangeValuePattern.cs (10)
253else if (propValue is DateTime) 255return (double)((DateTime)propValue).Year; 292else if (propValue is DateTime) 294return (double)((DateTime)propValue).Year; 321else if (propValue is DateTime) 323return (double)((DateTime)propValue).Year; 354else if (propValue is DateTime) 356return (double)((DateTime)propValue).Year; 386else if (propValue is DateTime) 388return (double)((DateTime)propValue).Year;
UnitTests.Common (2)
TestTypes.cs (2)
407private DateTime _dateTimeValue; 446public DateTime DateTimeValue
UnsupportedTypes (1)
CreateFrameworkTypes.cs (1)
187DataColumn orderDateDataColumn = new("orderDate", typeof(DateTime));
Wasm.Performance.ConsoleHost (3)
Scenarios\ComponentRenderingScenarioBase.cs (3)
33var startTime = DateTime.Now; 36var duration = DateTime.Now - startTime;
Wasm.Performance.Driver (8)
BenchmarkMeasurement.cs (1)
8public DateTime Timestamp { get; internal set; }
Program.cs (7)
146Timestamp = DateTime.UtcNow, 165Timestamp = DateTime.UtcNow, 180Timestamp = DateTime.UtcNow, 195Timestamp = DateTime.UtcNow, 211Timestamp = DateTime.UtcNow, 233Timestamp = DateTime.UtcNow, 248Timestamp = DateTime.UtcNow,
WebPubSubWeb (1)
Program.cs (1)
87await service.SendToAllAsync($"{DateTime.Now}: Hello from background service.");
WebTransportInteractiveSampleApp (1)
Program.cs (1)
172if (DateTime.Parse(cert.GetExpirationDateString(), null) >= DateTimeOffset.UtcNow)
WebTransportSampleApp (1)
Program.cs (1)
57if (DateTime.Parse(cert.GetExpirationDateString(), null) < DateTimeOffset.UtcNow)
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)
Calendar.Designer.cs (3)
57this.monthCalendar1.AnnuallyBoldedDates = new System.DateTime[] { 60this.monthCalendar1.BoldedDates = new System.DateTime[] { 64this.monthCalendar1.MonthlyBoldedDates = new System.DateTime[] {
XmlFileLogger (5)
LogProcessNode.cs (2)
56public DateTime StartTime { get; protected set; } 64public DateTime EndTime { get; set; }
ObjectModel\Message.cs (2)
17private readonly DateTime _timestamp; 24public Message(string message, DateTime timestamp)
XmlFileLogger.cs (1)
85_build.AddMessage(new Message(string.Format("XmlFileLogger Error: {0}", e), DateTime.Now));
xunit.assert (8)
EqualityAsserts.cs (6)
501 /// Verifies that two <see cref="DateTime"/> values are equal. 506 DateTime expected, 507 DateTime actual) => 511 /// Verifies that two <see cref="DateTime"/> values are equal, within the precision 518 DateTime expected, 519 DateTime actual,
Sdk\ArgumentFormatter.cs (1)
234 if (value is DateTime || value is DateTimeOffset)
Sdk\AssertHelper.cs (1)
466 if (expectedType == typeof(DateTime) || expectedType == typeof(DateTimeOffset))
xunit.console (1)
ConsoleRunner.cs (1)
306assembliesElement.Add(new XAttribute("timestamp", DateTime.Now.ToString(CultureInfo.InvariantCulture)));