It all looks happy, except the part about "adjusted to timezone".  If this 
repository become a global entity or if daylight savings time is a factor, 
maybe zulu (GMT) time is the best solution.

Al Ginbey

From: [email protected] 
[mailto:[email protected]] On Behalf Of Tim
Sent: Thursday, May 30, 2013 12:29 AM
To: 'MarkLogic Developer Discussion'
Subject: EXT :Re: [MarkLogic Dev General] Creating a unique timestamp 
usingfn:current-dateTime()

Hi Folks,

This has been a lively discussion.  Thank you for all of your input.  What I 
decided to do is to create a unique document name by combining the user ID and 
the results of xdmp:random(), but to create a dated archive of updates to the 
document, to the unique document name I added the current datetime adjusted to 
timezone with all nondigits removed:

let $tz := fn:adjust-dateTime-to-timezone (fn:current-dateTime(), 
xs:dayTimeDuration ("PT0H"))
return fn:concat($dts, " | ", $tz, " | ", fn:replace($tz cast as xs:string, 
"[:\-TZ\.]", ""));
Tim

From: 
[email protected]<mailto:[email protected]>
 [mailto:[email protected]] On Behalf Of Tim
Sent: Wednesday, May 29, 2013 12:08 PM
To: 'MarkLogic Developer Discussion'
Subject: [MarkLogic Dev General] Creating a unique timestamp using 
fn:current-dateTime()


Hi Folks,



I am using fn:current-dateTime() to create a unique timestamp for creating 
archive filenames, e.g.,



let $dt := fn:current-dateTime() cast as xs:string
return replace(substring($dt, 1, 22), "[:\-T\.]", "")



To make it truly unique I need to include part of the fraction of a second, but 
I noticed that fn:current-dateTime() does not always  return the same number of 
digits for fractions of a second.  I have seen results with a range anywhere 
from 2 to 6 digits.  Is there a minimum amount of digits that will be supplied 
in the fractions digits?



Thank you!



Tim Meagher


_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to