Commodore
Commodore
365 views

Timestamp manipulation via local variable

Hi, 

Can anybody help with a scenario to create local variable that would calculate timestamp similar to "$Now - 24h" ? For instance I have creation time and need to show it in a report exactly 24 hours earlier.

 

0 Likes
3 Replies
Vice Admiral
Vice Admiral

I had the same issue with one of my use cases. My quick solution looks loke this:

Local Variables:

  YourDay = GetDayOfMonth(EndTime)
  DayBefore = add(YourDay,-1)
  YourMonth = GetMonthOfYear(EndTime)
  YourYear = …
  ...

after that you convert all variables to strings and concatenate them. Now you have a string that contains your timestamp (-24h). You can even convert from string to date (if you need a variable of type date). 

There's one drawback: If your timestamp is Dec 01 you get Dec 00 (not Nov 30). You might solve this issue by using additional local variables with condition-function (I was to lazy to do this…).

0 Likes
Commodore
Commodore

I dont understand your requirement. Please elaborate.
Manoj S.
0 Likes
Commodore
Commodore

Hi, 

 

thanks for you reply. I need to take a timestamp from the, say Manager Receipt Time field, extract 1 day and put new timestamp (as date type) to the Active List or assign it to deviceCustomDate field.

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.