bamboo.buildTimeStamp format

Hi all,

We're rolling some projects across from Hudson into Bamboo and have hit a problem with one of them.

This project builds with Ant and uses some of the Hudson timestamp variables to set the build time into an environment variable. The environment variable is in turn used to create a specific build folder.

I tried to do the same thing using Bamboo's buildTimeStamp variable, but unfortunately for me it is listed as "ISO8601" which means that it gives a full dump in the full format specified in that standard - including some characters that the OS doesn't like as part of directory names.

I can't find anything to suggest that alternate formatting which are also part of that standard are supported, or how to specify them.

I'd like the timestamp in DDMMYYYY format, so is anyone able to help with able to get that output from this variable?

In the meantime, I'm just going to set it to use the build number so the project can at least execute.


Jason [SolveIT Software]

3 answers

1 accepted

Hi Jason,

There isn't any way to change the bamboo.buildTimeStamp format, however I've opened up an improvement request to add a similar variable that outputs to a simpler date format that is more file system friendly.



Thanks for that James, I'll watch for the enhancement in some future Bamboo release... but as I said we'll just use the build ID for the moment, and that's successful.

I'm having the same issue. All I really want is "yyyyMMdd"

You can actually set a plan variable to the system date if this is building on a linux machine by setting the value of the plan variable to something like

$(date +"%m-%d-%y-%l-%M-%S")

This will return as mm-dd-yy-hh-mm-ss.  You could change the format to that of your liking.  However this will not transfer to a deployment plan as the deployment plan picks up the string and not the value returned by it.

Workaround for now:

Create a script task in bamboo:

echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > timestamp.pom
echo "<project xmlns=\"\" xmlns:xsi=\"\" xsi:schemaLocation=\"\">" >> timestamp.pom
echo -n "<version>" >> timestamp.pom
echo -n `date +'%Y%m%d%H%M%S'` >> timestamp.pom
echo "</version>" >> timestamp.pom
echo "</project>" >> timestamp.pom

Use the "Maven POM Value Extractor" plugin. Override the project file in this task to read from timestamp.pom

Now the custom timestamp is available in ${bamboo.maven.version}

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted 5 hours ago in United States

Atlassian acquires AgileCraft

         Good Day, Bad bad traffic, not sure why!!!! 1/2 hour commute took me 2 hours today 🤯 What helped me is that I kept browsing LinkedIn until...

26 views 1 0
View post

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you