【问题标题】:Is there an open source .NET equivalent to the date.js library?是否有与 date.js 库等效的开源 .NET?
【发布时间】:2010-07-20 19:29:03
【问题描述】:

只是想知道是否有人知道处理日期的开源 .Net 库类似于 date.js 库,它允许您执行以下操作。

// What date is next thursday?
Date.today().next().thursday();

// Add 3 days to Today
Date.today().add(3).days();

// Is today Friday?
Date.today().is().friday();

// Number fun
(3).days().ago();

// 6 months from now
var n = 6;
n.months().fromNow();

// Set to 8:30 AM on the 15th day of the month
Date.today().set({ day: 15, hour: 8, minute: 30 });

// Convert text into Date
Date.parse('today');
Date.parse('t + 5 d'); // today + 5 days
Date.parse('next thursday');
Date.parse('February 20th 1973');
Date.parse('Thu, 1 July 2004 22:30:00');

我意识到 .Net 中的 DateTime 对象已经支持其中的一些功能。我对最后一段以智能方式解析字符串的代码特别感兴趣。

【问题讨论】:

标签: .net date


【解决方案1】:

我认为在 .NET 世界中,您最接近 date.js 的是 noda-time

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-05-21
    • 2011-09-21
    • 2011-05-31
    • 2011-01-07
    • 2010-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多