XML-XSLT : How to compare two dates which are in String

前端 未结 2 1430
清歌不尽
清歌不尽 2021-01-27 19:02

I know this question might get repeated and also I have went through similar articles and question but I have not found the exact solution.

Now the question I am using <

2条回答
  •  爱一瞬间的悲伤
    2021-01-27 19:16

    XSLT (2.0) recognizes dates in YYYY-MM-DD format only, and date-times in YYYY-MM-DDThh:mm:ss format only. In order to compare the strings as dates, (or, in this case, date-times), you must first convert them to valid date-times. Since you need to do this more than once, it would be convenient to construct a function for this purpose:

    XSLT 2.0

    
    
    
    
    
    
    
    
         
        
        
    
    
    
        
            
        
    
    
    
    

    Result

    
    OK
    

    Note that this assumes your strings come in a DD.MM.YYYY hh:mm:ss format - i.e. that the days are padded to two digits - otherwise there's more work to be done.

提交回复
热议问题