Return-Path: Delivered-To: apmail-jakarta-jmeter-user-archive@www.apache.org Received: (qmail 51432 invoked from network); 2 Nov 2004 07:47:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 2 Nov 2004 07:47:06 -0000 Received: (qmail 75598 invoked by uid 500); 2 Nov 2004 07:47:01 -0000 Delivered-To: apmail-jakarta-jmeter-user-archive@jakarta.apache.org Received: (qmail 75546 invoked by uid 500); 2 Nov 2004 07:47:00 -0000 Mailing-List: contact jmeter-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "JMeter Users List" Reply-To: "JMeter Users List" Delivered-To: mailing list jmeter-user@jakarta.apache.org Received: (qmail 75530 invoked by uid 99); 2 Nov 2004 07:47:00 -0000 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=DNS_FROM_RFC_ABUSE X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from [66.134.72.15] (HELO panorama.Covad.COM) (66.134.72.15) by apache.org (qpsmtpd/0.28) with ESMTP; Mon, 01 Nov 2004 23:47:00 -0800 Received: from zanxmb00.cc-ntd1.covad.com (zanxmb00.corp.covad.com [172.16.2.119]) by panorama.Covad.COM (8.9.3/8.8.7) with ESMTP id XAA16582 for ; Mon, 1 Nov 2004 23:46:58 -0800 (PST) Received: from ZANEVS03.cc-ntd1.covad.com ([172.16.2.84]) by zanxmb00.cc-ntd1.covad.com with Microsoft SMTPSVC(5.0.2195.5329); Mon, 1 Nov 2004 23:46:58 -0800 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: createing MM/DD/YYYY date string Date: Mon, 1 Nov 2004 23:46:58 -0800 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: createing MM/DD/YYYY date string Thread-Index: AcTAsCGwpwSI4lYoRCW0U9snOx+N7w== From: "Xie, Shawn Y." To: X-OriginalArrivalTime: 02 Nov 2004 07:46:58.0773 (UTC) FILETIME=[21D6F850:01C4C0B0] X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi, In my functional test plan, I need to assert a page contains today's = date string as MM/DD/YYYY (e.g. 01/02/2004 for Jan 2, 2004) or not. I = tried to use JMeter javascript function to dynamically generate the date = string. It seems JMeter javascript cannot run multiple lines of code = (Please confirm this), I finally end up at an ugly, but close to work = solution by defining a variable name as 'today' and value part as: =20 ${__javaScript((((new Date().getMonth()+1)<10)?('0'+new = Date().getMonth()+1):(new Date().getMonth()+1))+"/"+(new = Date().getDate()<10?('0'+new Date().getDate()):new = Date().getDate())+"/"+(new Date().getYear()+1900),)} =20 =20 I said "close to work" as above code does return MM/DD/YYYY as expected = but it somehow always appends with 3 white spaces at the end of it. = These white spaces prevents me from using ${today} in the assertion as = in the page the date has no space following it. =20 What I need your help are: 1. Is there a elegant way to generate MM/DD/YYYY in JMeter? 2. How to trim the white spaces at an javascript return (again in = JMeter)? =20 =20 Thanks a lot for your help in advance. =20 -Shawn --------------------------------------------------------------------- To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: jmeter-user-help@jakarta.apache.org