In Sameera's example, the time will be in seconds (because of the /1000 on it). 
If you need a true epoch timestamp (milliseconds
since epoch) you will need to remove that.

        ${__javaScript(new Date().getTime();)}

Is the simplest form of that.

Just use that variable in any fields you need it (note, it will create a new 
timestamp each time you use it). You can also create 1
timestamp, and store it in a variable - then use the variable.

There are 2 ways to do this:

1) If you want just 1 value for the whole test, add a "User Defined Variables" 
Config Element to your test. This will be evaluated
when you load the test script the first time.

2) If you want to have the value change for every thread execution, but stay 
the same during each thread instance: under your
'Thread Group', add a 'Pre Processors -> User Parameters' to your thread group 
- and add the variable there.

Also, if you want the value to change each time the thread starts over (each 
'iteration' of the script within the thread group), you
can check the "Update Once Per Iteration" box on the User Parameters - and it 
will get a new value each time it starts the thread
over at the beginning of th test script (within that thread group).

--
Robin D. Wilson
Sr. Director of Web Development
KingsIsle Entertainment, Inc.
VOICE: 512-777-1861
www.KingsIsle.com


-----Original Message-----
From: Sameera Rao P [mailto:[email protected]] 
Sent: Tuesday, August 28, 2012 9:14 AM
To: JMeter Users List
Subject: RE: Can JMeter generate a epoch time stamp?

Hi,

You can add this function directly where you want to generate the epoch time 
and then post. Please find below the example

<eb:Timestamp>${__javaScript(Math.round(new Date().getTime() / 
1000))}</eb:Timestamp>



 
Thanks & Regards
Sam


-----Original Message-----
From: Larry Williams [mailto:[email protected]] 
Sent: Tuesday, August 28, 2012 7:38 PM
To: JMeter Users List
Subject: RE: Can JMeter generate a epoch time stamp?

Thank you for the reply Sam!
Can you tell me how I can have Jmeter run that function?
I'm a novice and so do not know :(

Thanks!

Larry Williams
Sr CNC Admin * Information Services Department
[email protected] * 206-297-5766
Mobile:  206-409-9337
5303 Shilshole Ave. N.W. * Seattle, WA 98107-4000

-----Original Message-----
From: Sameera Rao P [mailto:[email protected]]
Sent: Tuesday, August 28, 2012 7:03 AM
To: JMeter Users List
Subject: RE: Can JMeter generate a epoch time stamp?

Hi,

You can try using the below function. This will act as unique id also

${__javaScript(Math.round(new Date().getTime() / 1000))}


Thanks & Regards
Sam

-----Original Message-----
From: Larry Williams [mailto:[email protected]]
Sent: Tuesday, August 28, 2012 7:27 PM
To: [email protected]
Subject: Can JMeter generate a epoch time stamp?

Hi all,

I have a web based java app that requires I pass an epoch time stamp in a post 
operation.
Does anyone know how I can get Jmeter to generate it?

Thanks you in advance!

Larry Williams
Sr CNC Admin * Information Services Department 
[email protected]<mailto:[email protected]> * 
206-297-5766
Mobile:  206-409-9337
5303 Shilshole Ave. N.W. * Seattle, WA 98107-4000


________________________________

CONFIDENTIALITY NOTICE
The information in this message is intended only for the addressee or the 
addressee's authorized agent. The message may contain
information that is privileged, confidential, or otherwise exempt from 
disclosure. If the reader of this message is not the intended
recipient or the recipient's authorized agent, then you are notified that any 
dissemination, distribution or copying of this message
is prohibited. If you have received this message in error, please reply to the 
sender and then delete the message.

============================================================================================================================
Disclaimer:  This message and the information contained herein is proprietary 
and confidential and subject to the  Tech Mahindra
policy statement, you may review the policy at <a
href="http://www.techmahindra.com/Disclaimer.html";>http://www.techmahindra.com/Disclaimer.html</a>
externally and <a 
href="http://tim.techmahindra.com/tim/disclaimer.html";>http://tim.techmahindra.com/tim/disclaimer.html</a>
internally within Tech Mahindra.
============================================================================================================================

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



________________________________

CONFIDENTIALITY NOTICE
The information in this message is intended only for the addressee or the 
addressee's authorized agent. The message may contain
information that is privileged, confidential, or otherwise exempt from 
disclosure. If the reader of this message is not the intended
recipient or the recipient's authorized agent, then you are notified that any 
dissemination, distribution or copying of this message
is prohibited. If you have received this message in error, please reply to the 
sender and then delete the message.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


============================================================================================================================
Disclaimer:  This message and the information contained herein is proprietary 
and confidential and subject to the
 Tech Mahindra policy statement, you may review the policy at <a
href="http://www.techmahindra.com/Disclaimer.html";>http://www.techmahindra.com/Disclaimer.html</a>
 
externally and <a 
href="http://tim.techmahindra.com/tim/disclaimer.html";>http://tim.techmahindra.com/tim/disclaimer.html</a>
internally within Tech Mahindra.
============================================================================================================================

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to