public synchronized static String getUnique14DigitDate ( ) { long effectiveNow = System . currentTimeMillis ( ) ; effectiveNow = Math . max ( effectiveNow , LAST_UNIQUE_NOW14 + 1 ) ; String candidate = get14DigitDate ( effectiveNow ) ; while ( candidate . equals ( LAST_TIMESTAMP14 ) ) { effectiveNow += 1000 ; candidate = get14DigitDate ( effectiveNow ) ; } LAST_UNIQUE_NOW14 = effectiveNow ; LAST_TIMESTAMP14 = candidate ; return candidate ; }
Utility function for creating UNIQUE - from - this - class arc - style date stamps in the format yyyMMddHHmmss . Rather than giving a duplicate datestamp on a subsequent call will increment the seconds until a unique value is returned .