没有任何数据可供显示
开源项目社区 | 当前位置 : |
|
www.trustie.net/open_source_projects | 主页 > 开源项目社区 > prettytimedotnet |
prettytimedotnet
|
0 | 0 | 4 |
贡献者 | 讨论 | 代码提交 |
PrettyTime.NET is an OpenSource .NET time comparison library for creating human readable time. This is a modified version of PrettyTime, created by Lincoln Baxter, III from OcpSoft. PrettyTime can be found at http://code.google.com/p/prettytime/.
Completely customizable, PrettyTime.NET creates human readable, relative timestamps like those seen on Digg, Twitter, Gmail, Facebook and FeedWatchdog. It's simple, get started "right now!"
Simple Exampleprivate string PrettyItUp(DateTime Date)
{
using (PrettyTime.PrettyTime p = new PrettyTime.PrettyTime())
return p.format(Date);
}minutes from now test///
/// A test for minutes from now
///
[TestMethod()]
public void MinutesFromNow()
{
using (PrettyTime p = new PrettyTime())
{
Assert.AreEqual(“12 minutes from now”, p.format(DateTime.Now.AddMinutes(12)));
}
}days ago test///
/// A test for days ago
///
[TestMethod()]
public void DaysAgo()
{
using (PrettyTime p = new PrettyTime())
{
Assert.AreEqual(“3 days ago”, p.format(DateTime.Now.AddDays(-3)));
}
}