Highlighted
taylormasd Absent Member.
Absent Member.
797 views

Date and Time variables in an "edit text file action"

I am trying to use an edit text file action at the beginning and the end of a bundle to log the start time and end time of the bundle.

Here are the actions I have in my test bundle
Edit Text file, append line "Started running test-test-testy-test on ${YEAR}-${MONTH}-${DAY} at ${HOUR24}:${MINUTE}.${SECOND}"
Delay 120 seconds
Edit Text file, append line "Finished running test-test-testy-test on ${YEAR}-${MONTH}-${DAY} at ${HOUR24}:${MINUTE}.${SECOND}"

I expect to see

Started running test-test-testy-test on 2013-7-27 at 23:57.00
Finished running test-test-testy-test on 2013-7-27 at 23:59.00

(assuming I run the bundle at 11:57pm on 7-27-2013)

But what I actually see is

Started running test-test-testy-test on 2013-7-27 at 23:57.00
Finished running test-test-testy-test on 2013-7-27 at 23:57.00

It would appear that the date/time variables I'm using are populated when the bundle starts running, and are not the CURRENT date and time.
Is there a way to update the variables, or better yet, is there a variable that just has the current date and time in it? like %date% and %time% in
a cmd/bat file?

Any help would be greatly appreciated!

Thanks in advance,

Taylor H :cool:
Labels (2)
Tags (3)
0 Likes
2 Replies
shaunpond Absent Member.
Absent Member.

Re: Date and Time variables in an "edit text file action"

Taylormasd,

variables are replaced at the time that the bundle is launched - you
could use separate bundles to do the logging and launch them before and
after your main app - that would work

--

Shaun Pond


0 Likes
taylormasd Absent Member.
Absent Member.

Re: Date and Time variables in an "edit text file action"

spond;2274738 wrote:
Taylormasd,

variables are replaced at the time that the bundle is launched - you
could use separate bundles to do the logging and launch them before and
after your main app - that would work

--

Shaun Pond


Thanks for the info Spond. I can understand some variables being static set at launch time, but date and time would be really useful to have as a more variable variable 😄

I ended up just using a run script > define your own script > echo blahblahblah >> mytextfile.txt

🙂

Taylor
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.