Thursday, December 1, 2011

OSB, how to get the equivalent of System.currentTimeMillis()

try:

(fn:current-dateTime() - xs:dateTime("1970-01-01T00:00:00-00:00")) div xdt:dayTimeDuration("PT0.001S")

(thanks to Luciano for this)


or do a Custom XPath returning System.currentTimeMillis() from Java.

1 comment:

Luis said...

Hi Master

Thanks for the post.
Just a small improvement to avoid decimal values:
xs:integer((fn:current-dateTime() - xs:dateTime("1970-01-01T00:00:00-00:00")) div xdt:dayTimeDuration("PT0.001S"))

Thanks