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


C# DateTime.PrettyDate方法代码示例

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


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

示例1: FourteenDaysAgo

 public void FourteenDaysAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 15, 0, 0, 0, 0);
     Assert.AreEqual("2 weeks ago", d.PrettyDate(now));
 }
开发者ID:dirkrombauts,项目名称:SirenOfShame,代码行数:6,代码来源:PrettyDateHelperTest.cs

示例2: WhenIsNow

 public void WhenIsNow()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     Assert.AreEqual("just now", d.PrettyDate(now));
 }
开发者ID:dirkrombauts,项目名称:SirenOfShame,代码行数:6,代码来源:PrettyDateHelperTest.cs

示例3: FiftyNineSecondsAgo

 public void FiftyNineSecondsAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 1, 0, 0, 59, 999);
     Assert.AreEqual("just now", d.PrettyDate(now));
 }
开发者ID:dirkrombauts,项目名称:SirenOfShame,代码行数:6,代码来源:PrettyDateHelperTest.cs

示例4: OneMinuteFiftyNineSecondsAgo

 public void OneMinuteFiftyNineSecondsAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 1, 0, 1, 59, 999);
     Assert.AreEqual("1 minute ago", d.PrettyDate(now));
 }
开发者ID:dirkrombauts,项目名称:SirenOfShame,代码行数:6,代码来源:PrettyDateHelperTest.cs

示例5: WriteDate

 private void WriteDate(DateTime eventDate)
 {
     _when.Text = eventDate.PrettyDate();
 }
开发者ID:dirkrombauts,项目名称:SirenOfShame,代码行数:4,代码来源:NewsItem.cs

示例6: OneDayTwentyThreeHoursAgo

 public void OneDayTwentyThreeHoursAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 2, 23, 59, 59, 999);
     Assert.AreEqual("yesterday", d.PrettyDate(now));
 }
开发者ID:dirkrombauts,项目名称:SirenOfShame,代码行数:6,代码来源:PrettyDateHelperTest.cs

示例7: OneHourFiftyNineMinutesAgo

 public void OneHourFiftyNineMinutesAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 1, 1, 59, 59, 999);
     Assert.AreEqual("1 hour ago", d.PrettyDate(now));
 }
开发者ID:dirkrombauts,项目名称:SirenOfShame,代码行数:6,代码来源:PrettyDateHelperTest.cs

示例8: ThreeWeeksAgo

 public void ThreeWeeksAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 28, 23, 59, 59, 999);
     Assert.AreEqual("3 weeks ago", d.PrettyDate(now));
 }
开发者ID:dirkrombauts,项目名称:SirenOfShame,代码行数:6,代码来源:PrettyDateHelperTest.cs

示例9: TwentyThreeHoursAgo

 public void TwentyThreeHoursAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 1, 23, 59, 59, 999);
     Assert.AreEqual("23 hours ago", d.PrettyDate(now));
 }
开发者ID:dirkrombauts,项目名称:SirenOfShame,代码行数:6,代码来源:PrettyDateHelperTest.cs

示例10: SixDaysAgo

 public void SixDaysAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 7, 23, 59, 59, 999);
     Assert.AreEqual("6 days ago", d.PrettyDate(now));
 }
开发者ID:dirkrombauts,项目名称:SirenOfShame,代码行数:6,代码来源:PrettyDateHelperTest.cs

示例11: ThirteenDaysAgo

 public void ThirteenDaysAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 14, 23, 59, 59, 999);
     Assert.AreEqual("last week", d.PrettyDate(now));
 }
开发者ID:dirkrombauts,项目名称:SirenOfShame,代码行数:6,代码来源:PrettyDateHelperTest.cs

示例12: SevenDaysAgo

 public void SevenDaysAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 8, 0, 0, 0, 0);
     Assert.AreEqual("last week", d.PrettyDate(now));
 }
开发者ID:dirkrombauts,项目名称:SirenOfShame,代码行数:6,代码来源:PrettyDateHelperTest.cs

示例13: OneYearAgo

 public void OneYearAgo()
 {
     var d = new DateTime(2009, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 2, 5, 0, 0, 0, 0);
     Assert.AreEqual(d.ToString("d"), d.PrettyDate(now));
 }
开发者ID:dirkrombauts,项目名称:SirenOfShame,代码行数:6,代码来源:PrettyDateHelperTest.cs

示例14: OneMonthAgoMin

 public void OneMonthAgoMin()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 2, 5, 0, 0, 0, 0);
     Assert.AreEqual("1 month ago", d.PrettyDate(now));
 }
开发者ID:dirkrombauts,项目名称:SirenOfShame,代码行数:6,代码来源:PrettyDateHelperTest.cs

示例15: FourWeeksAgo

 public void FourWeeksAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 2, 4, 23, 59, 59, 999);
     Assert.AreEqual("4 weeks ago", d.PrettyDate(now));
 }
开发者ID:dirkrombauts,项目名称:SirenOfShame,代码行数:6,代码来源:PrettyDateHelperTest.cs


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