net.corda.core.transactions / TransactionBuilder / setTime

# setTime

`fun setTime(time: Instant, timeTolerance: Duration): Unit`

Places a TimestampCommand in this transaction, removing any existing command if there is one. The command requires a signature from the Notary service, which acts as a Timestamp Authority. The signature can be obtained using NotaryFlow.

The window of time in which the final timestamp may lie is defined as time +/- timeTolerance. If you want a non-symmetrical time window you must add the command via addCommand yourself. The tolerance should be chosen such that your code can finish building the transaction and sending it to the TSA within that window of time, taking into account factors such as network latency. Transactions being built by a group of collaborating parties may therefore require a higher time tolerance than a transaction being built by a single node.

`fun setTime(newTimestamp: Timestamp): Unit`