For the shared directory, you can use build timestamp variable ${BUILD_ID}.
By default, this variable uses the pattern 'YYYY-MM-DD_hh-mm-ss'.
You can change this format by providing your own pattern.
You must specify a java.text.SimpleDateFormat pattern, as the value 'yyyyMMddHHmmss'.