This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
ted bishop wrote:I'm trying to get the current date in format mm/dd/yyyy. Using the code below I'm getting the date with a 2 digit year and no leading zeros (4/1/11).
def dateTime = new Date()
def date = dateTime.getDateString()
You should be able to use the SimpleDateFormat class from java. Not sure if there's a more Groovylicious way to do things but there's not much code involved in that.
You can read up about the SimpleDateFormat class though its API documentation SimpleDateFormat
Should be as simple as defining you're required date format and then formating the Date object to return the required string.
Amn't familiar with the setWebTestProperty method from the step class?
But the below seems to run ok from the groovy cmd line groovysh.
Prints out as:
Joined: Apr 01, 2011
Thanks for your reply. I got it to work using your example.