Highlighted
Absent Member.
Absent Member.
645 views

Date Format

I need one input parameter of type DateTime. But this parameter should take value from File. If i try to add as string parameter it displays in )1-May-1965 format. I need the format as 1/05/1965. Since this is not current date , lr_save_datetime won't work. Is there any soln apart from adding code lines to modifing format? any load runnner function call?
0 Likes
8 Replies
Highlighted
Absent Member.
Absent Member.

Take a look at fgets function from loadrunner function reference.
0 Likes
Highlighted
Established Member..
Established Member..

Hi Sanpal,

You can do that with the parameter list with Date/Time parameter type.

If required format dosen't exists you can create your own format and use the same. Follow below step to make the date in your required format:

1. Open parameter list.

2. Add new parameter use select type as Date/Time.

3. Type %d/%m/%y in Date/Time format field.

4. Press Add format tab. The customized format will get added in list.

5. Close the lise and now you can use the new created parameter at desired place.

Good Luck!!!

Thanks
Champ
0 Likes
Highlighted
Absent Member.
Absent Member.

thank you.. all the soln u specified above would fetch current date/time.My requirement is to pass parameter of type date, but to store user defined date/time value like DOB.lr_save_datetime would give me flexibility to change format for current date or other system defined date/time. but not userdefined?
0 Likes
Highlighted
Established Member..
Established Member..

Hi Sanpal,

I believe it can be done the way I have suggested. You just need follow the steps which I have posted above. Check that once in your script.

Thanks,
Champ

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Look at the lr_save_datetime again. There is an offset value that allows you to change from current data/time.
0 Likes
Highlighted
Absent Member.
Absent Member.

Again , may be i'm not making myself clear. It is not about format, it about value of date. when i add format it will still fetch system value current one. How can i generalize offset value in lr_save_datetime.
My input file(csv file) contains:
FirstName LastName DOB
john smith 23/06/1987
Jim Carry 01//01/1956

But i need to create parameter of date and fetch DOB columns from file on each iteration. .
0 Likes
Highlighted
Absent Member.
Absent Member.

Why dont you change the format of the cell in the CSV file contains date field as LR picks the input value from a paramitrised file as string only.
0 Likes
Highlighted
Absent Member.
Absent Member.

good point, but my script also fetches DOB from db. From DB , date is returned as string in format 12-May-1982. I need to do compare b/w input and Database returned DOB. i need to add few lines to change format for DOB from DataBase to match input. Since i'm newbie to loadrunner, i thought there might be simple fun call.. that y posted here for experts suggestion 🙂
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.