jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepak Shetty <shet...@gmail.com>
Subject Re: add time to current time
Date Mon, 22 Feb 2010 19:23:44 GMT
Hi
in beanshell
import java.util.Date;
import java.text.SimpleDateFormat;

long millis = System.currentTimeMillis() + 1500; // value you want to add
Date d = new Date(millis);
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
String formattedDate = sdf.format(d);

You could put the returned value in a variable or reuse the beanshell
function or whatever
vars.put("formattedDate", formattedDate);

regards
deepak
On Mon, Feb 22, 2010 at 8:55 AM, noc2007 <dhpzundert@hotmail.com> wrote:

>
> thanks for your answer;
> do you think i can find an example of that?
>
> thanks in advance
>
>
> sebb-2-2 wrote:
> >
> > On 22/02/2010, noc2007 <dhpzundert@hotmail.com> wrote:
> >>
> >>  In JMeter it is possible to use the current time in you script, and
> >> format is
> >>  in the way we like, for example:
> >>  ${__time(HH:mm:ss)}.
> >>
> >>  I would like to know if it possible to add a number of (milli)seconds
> or
> >>  minutes to the current time and use the same format.
> >
> > Currently not possible using the __time() function.
> >
> > However, you can use the __BeanShell(), __javaScript() or __jexl()
> > functions to invoke the appropriate Java methods.
> >
> >>  thanks in advance
> >>
> >> --
> >>  View this message in context:
> >> http://old.nabble.com/add-time-to-current-time-tp27686680p27686680.html
> >>  Sent from the JMeter - User mailing list archive at Nabble.com.
> >>
> >>
> >>  ---------------------------------------------------------------------
> >>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> >>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/add-time-to-current-time-tp27686680p27690426.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message