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, xs:dateTime('1970-01-01T00:00:00'))
but it just returns 0.
Please advice. Thanks.
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, xs:dateTime('1970-01-01T00:00:00'))
but it just returns 0.
Please advice. Thanks.
As an xpath which does not use division but extracts from the duration:
This transformation:
when applied on any XML document (not used), produces the wanted result -- the current date-time and its Unix epoch (the number of seconds since 1/1/1970 ):
A pure xsl 1.0 lib example:
Output:
time_as_timestamp:1365599995640
time_as_xsdatetime:2013-04-10T13:19:55.640Z
converted back:1365599995640