我正在使用 HTML Helper 生成 Timestamp.js 标记<abbr>
public static MvcHtmlString TimeAgo(this HtmlHelper html,
DateTime dateTime)
{
var tagBuilder = new TagBuilder("abbr");
tagBuilder.SetInnerText(String.Format("{0:MMMM d, yyyy}", dateTime));
tagBuilder.AddCssClass("timeago");
tagBuilder.Attributes.Add("title", String.Format("{0:s}Z", dateTime));
return MvcHtmlString.Create(tagBuilder.ToString());
}
生成以下内容:
<abbr class="timeago" title="July 2, 2014">6 minutes ago</abbr>
没关系,除了我想在标题标签上有一个完整的日期时间,因为我发现它对最终用户更有用。
可能吗?
非常感谢朋友,