Highlighted
David Taggart Respected Contributor.
Respected Contributor.
1766 views

Parsing time-stamps in HTML, performing DateTime arithmetic.

I'm attempting to write a synthetic transaction in Silk Performer 16.5. I need to upload a file to a server using an HTML form, and once that is complete I need to make a time-stamp and compare it to another time-stamp on a confirmation page. When I visit the confirmation page, I receive the web site's time stamp in the format of "DD-Mon-YYYY HH:MM:SS". Ideally, I need to find a way to make sure that the time-stamp taken after the script triggers the form is within 15 minutes of the time-stamp reported on the status page.

A coworker suggests that I get both time-stamps in Epoch time and do simple arithmetic:

If (ConfirmationTime - UploadTime < 900s) {
    return 1;
}
else {return 0;}

I might be able to convince my team to allow .NET code, but I'd prefer to do this natively in BDL.

Tags (3)
0 Likes
4 Replies
ckim9 Absent Member.
Absent Member.

RE: Parsing time-stamps in HTML, performing DateTime arithmetic.

Use GetTime() to get the start time. Then use it again later to calculate the elapsed time. Since GetTime() returns the number of seconds since midnight, you will need to consider the case where your test spans two days.

0 Likes
David Taggart Respected Contributor.
Respected Contributor.

RE: Parsing time-stamps in HTML, performing DateTime arithmetic.

This test runs 24x7 so it does have the potential to cross midnight. I'll still need to parse the date as published by the webapp on the confirmation page, not just two time stamps taken at different points in the script.

0 Likes
Micro Focus Expert
Micro Focus Expert

RE: Parsing time-stamps in HTML, performing DateTime arithmetic.

I'd like to point out GetTime is:

Returns the number of seconds elapsed since midnight (00:00:00), January 1, 1970 likewise as GMT or local time.

The important part is since Jan 1 1970.

0 Likes
David Taggart Respected Contributor.
Respected Contributor.

RE: Parsing time-stamps in HTML, performing DateTime arithmetic.

That is what the documentation also led me to believe. Time counted from January 1st, 1970 is called Epoch, Unix, or POSIX time.

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.