Convert dateTime to unix epoch in xslt

前端 未结 3 886
余生分开走
余生分开走 2020-12-31 10:37

I have a dateTime variable, and I want to convert it to a decimal value of epoch. How can this be done?

I tried using:

seconds-from-duration($time, x         


        
3条回答
  •  不知归路
    2020-12-31 11:08

    As an xpath which does not use division but extracts from the duration:

    for $i in (current-dateTime()-xs:dateTime('1970-01-01T00:00:00Z')) 
        return ((days-from-duration($i)*86400)+(hours-from-duration($i)*3600)+(minutes-from-duration($i)*60)+(seconds-from-duration($i)))
    

提交回复
热议问题