jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: way to get current date into a variable?
Date Thu, 19 May 2005 23:04:32 GMT
On 5/19/05, Seth Ladd <seth@ehawaii.gov> wrote:
> Hello,
> 
> I searched the FAQs and manual, but couldn't find this answer.
> 
> Is there a way to get the current date into reference name?  I need to
> set some input fields to "today".
> 

Yes, several methods. All rely on functions.

1) Get the date from the OS, and set a property on the command line
with the value, then use one of the property functions to retrieve it.
E.g.
jmeter -Dtoday="`date`"
Then refer to it as ${today}

2) Use the JavaScript function to create a suitable date string, e.g. 
${__javaScript(new Date(),Dummy)}

3) Use the BeanShell function to create a suitable date string e.g.
${__BeanShell(new java.util.Date())}

You'll need to adjust the format.

S.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Mime
View raw message