Here's a quick way to obtain the number of milliseconds since January 1st 1970 of any date in XPath 2.0.
If your variable contains a date in the format of xs:date (YYYY-MM-DD), then you can use:
(xs:date($myvar) - xs:date('1970-01-01'))
div xs:dayTimeDuration('PT0.001S')
If your variable contains a date in the format of xs:dateTime, then you can use:
(xs:dateTime($myvar) - xs:dateTime('1970-01-01T00:00:00'))
div xs:dayTimeDuration('PT0.001S')
Based on this FAQ entry.

Add new comment