當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。