zoukankan      html  css  js  c++  java
  • dvwp date period filter

    [contains(@Title,$pwid) and
    (($start = '') or (ddwrt:FormatDateTime(@Date,1033,'yyyyMMdd') >= $start)) and
    (($end = '') or (ddwrt:FormatDateTime(@Date,1033,'yyyyMMdd') < $end))]

    =====================================================

    Displaying today's date using XSL and SharePoint

    Lately I have been using SharePoint Designer alot for modifying SharePoint pages. This is very largely based around XSL, and today I had the task of comparing a date to today's date. This meant of course that I would need today's date. It was after a little searching I found this incredible resource here, which details a whole stack of hidden functions in the ddwrt space that SharePoint has access to when displaying pages.  

    From this I quickly found out that I could easily use the following to display today's date: 

     

     < xsl:value-of select="ddwrt:Today()">

     

    I quickly also learnt that to display a date variable in the different formats you simply use the following function:
    FormatDate(string szDate, long lcid, long formatFlag) where I am using FormatDate(@Today, 1033, @No); 
     

    1  : 5/9/2007
    3  : Wednesday, May 09, 2007
    4  : 9:06 AM
    5  : 5/9/2007 9:06 AM
    7  : Wednesday, May 09, 2007 9:06 AM
    12: 9:06:12 AM
    13: 5/9/2007 9:06:12 AM
    15: Wednesday, May 09, 2007 9:06:12 AM

    This didn't help for doing a date compare. Lucky there was one other function to try out -
    FormatDateTime(string szDate, long lcid, string szFormat);

    So by using it:   

     

     < xsl:value-of select="ddwrt:FormatDateTime(string(ddwrt:Today()), 1033,'yyyyMMdd')" > < /xsl:value-of > 

    I was able to get the date 20070509 (for May 9, 2007 for example) which meant I was almost there for doing my date compare.
    Finally then, to check for a date that is expiring today, or has expired I was then able to use the simple XSL query: 

    Expired!! < /xsl:if >

     < xsl:if test="ddwrt:FormatDateTime(string(ddwrt:Today()), 1033, 'yyyyMMdd') >= ddwrt:FormatDateTime(string(@Milestone_x0020_Date), 1033, 'yyyyMMdd')" >
  • 相关阅读:
    ip地址和子网掩码
    Mysql 进阶查询 (select 语句的高级用法)
    MHA高可用配置及故障切换
    数据库的备份与恢复需要修改
    每天一分钟,了解mysql索引,事务与存储引擎
    mysql基础命令详解
    带你走进mysql数据库
    Spring XML无自动提示
    Spring环境搭建错误
    读书笔记_java设计模式深入研究 第十一章 装饰器模式 Decorator
  • 原文地址:https://www.cnblogs.com/icedog/p/1827079.html
Copyright © 2011-2022 走看看