当前位置: 首页>>代码示例>>C#>>正文


C# LocalDateTime.ToDateTimeUnspecified方法代码示例

本文整理汇总了C#中LocalDateTime.ToDateTimeUnspecified方法的典型用法代码示例。如果您正苦于以下问题:C# LocalDateTime.ToDateTimeUnspecified方法的具体用法?C# LocalDateTime.ToDateTimeUnspecified怎么用?C# LocalDateTime.ToDateTimeUnspecified使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LocalDateTime的用法示例。


在下文中一共展示了LocalDateTime.ToDateTimeUnspecified方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ToDateTimeUnspecified

 public void ToDateTimeUnspecified()
 {
     LocalDateTime zoned = new LocalDateTime(2011, 3, 5, 1, 0, 0);
     DateTime expected = new DateTime(2011, 3, 5, 1, 0, 0, DateTimeKind.Unspecified);
     DateTime actual = zoned.ToDateTimeUnspecified();
     Assert.AreEqual(expected, actual);
     // Kind isn't checked by Equals...
     Assert.AreEqual(DateTimeKind.Unspecified, actual.Kind);
 }
开发者ID:manirana007,项目名称:NodaTime,代码行数:9,代码来源:LocalDateTimeTest.cs

示例2: IsoDayOfWeek_AroundEpoch

 public void IsoDayOfWeek_AroundEpoch()
 {
     // Test about couple of months around the Unix epoch. If that works, I'm confident the rest will.
     LocalDateTime dateTime = new LocalDateTime(1969, 12, 1, 0, 0);
     for (int i = 0; i < 60; i++)
     {
         // Check once per hour of the day, just in case something's messed up based on the time of day.
         for (int hour = 0; hour < 24; hour++)
         {
             Assert.AreEqual(BclConversions.ToIsoDayOfWeek(dateTime.ToDateTimeUnspecified().DayOfWeek),
                 dateTime.IsoDayOfWeek);
             dateTime = dateTime.PlusHours(1);
         }
     }
 }
开发者ID:nicklbailey,项目名称:nodatime,代码行数:15,代码来源:LocalDateTimeTest.cs


注:本文中的LocalDateTime.ToDateTimeUnspecified方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。