【问题标题】:SharePoint Designer 2010 - Determine if today's date is within x days of a start date column using conditional formattingSharePoint Designer 2010 - 使用条件格式确定今天的日期是否在开始日期列的 x 天内
【发布时间】:2011-03-10 16:43:39
【问题描述】:

我正在使用 SPD 2010 和 Sharepoint Server 2010。

使用条件格式我正在尝试格式化列表,以便如果今天的日期比开始日期列晚 3 天以上,则单元格将变为红色。

直接比较两个日期列(查看今天是否在开始日期之后)效果很好 -

ddwrt:DateTimeTick(ddwrt:GenDisplayName(string($thisNode/@StartDate))) $Today)) )

但如果我添加一个数字,它将在 SPD 设计视图中起作用,但在实际的 SharePoint 网站上不起作用。

ddwrt:DateTimeTick(ddwrt:GenDisplayName(string($thisNode/@StartDate))) + 3 $Today)))

我尝试将 3 转换为刻度 -> 8,640,000/天并使用该值,但这也不起作用(在 SPD 设计视图中也不起作用)。

如果我创建一个计算日期为“StartDate+3”的列,然后直接比较它,我可以使格式正常工作,但是,如果该列不可见并且我宁愿不创建它,它就不起作用附加列。

有什么想法吗?

感谢您的帮助。

【问题讨论】:

    标签: sharepoint sharepoint-2010 sharepoint-designer conditional-formatting


    【解决方案1】:

    以下内容对我有用:

    number(ddwrt:FormatDateTime(ddwrt:FormatDate(string($thisNode/@StartDate),1033,1),1033,'yyyyMMdd')+3)

    【讨论】:

    • 您应该勾选接受此答案以表明问题已关闭(对像我这样可能迟到的回答者很有用)。 :)
    • 谢谢 Stuart,我担心接受你自己的答案是 StackOverflow 失礼。
    • 谢天谢地没有,但很遗憾你没有得到 +15 接受的答案奖励。
    【解决方案2】:

    我不知道为什么,但这对我不起作用。第二个 FormatDateTime 参数 - 'yyyyMMdd' - 不断抛出错误。

    这终于奏效了:

    number(translate(substring-before(@StartDate,'T'),'-',''))+3 <= number(translate(substring-before($Today,'T'),'-',''))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-08
      • 1970-01-01
      相关资源
      最近更新 更多