You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by satish <Sa...@cable.comcast.com> on 2010/10/26 16:57:28 UTC

DateTime stamp in ISO format


Hi,
I'm trying to add the DateTIme stamp to on of my queries in the following
format: yyyy-MM-dd HH:mm:ss. 
I am using the following Javascript function to do this.
${__javaScript(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new
java.util.Date()))}
Does not seem to work. I get an empty string. Any ideas on how to correct
this? 

Thanks,
Satish
-- 
View this message in context: http://jmeter.512774.n5.nabble.com/DateTime-stamp-in-ISO-format-tp3237193p3237193.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


Re: DateTime stamp in ISO format

Posted by Deepak Shetty <sh...@gmail.com>.
your code snippet is for java not JavaSript replace __javaScript with
__BeanShell (and it should be java.text.SimpleDateFormat)
If you want to use javaScript you will have to create a date object and
invoke methods on it (to get years,day,month , hours etc) and concatenate
the result in the format you want

regards
deepak

On Tue, Oct 26, 2010 at 7:57 AM, satish <
Satish_Anupindirao@cable.comcast.com> wrote:

>
>
> Hi,
> I'm trying to add the DateTIme stamp to on of my queries in the following
> format: yyyy-MM-dd HH:mm:ss.
> I am using the following Javascript function to do this.
> ${__javaScript(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new
> java.util.Date()))}
> Does not seem to work. I get an empty string. Any ideas on how to correct
> this?
>
> Thanks,
> Satish
> --
> View this message in context:
> http://jmeter.512774.n5.nabble.com/DateTime-stamp-in-ISO-format-tp3237193p3237193.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
>
>

Re: DateTime stamp in ISO format

Posted by black gaff <jo...@gmail.com>.
you could also use the __time function to achieve this


http://jakarta.apache.org/jmeter/usermanual/functions.html#__time
-- 
View this message in context: http://jmeter.512774.n5.nabble.com/DateTime-stamp-in-ISO-format-tp3237193p3237325.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