Highlighted
indranil2121 Absent Member.
Absent Member.
484 views

Not able to get unix time formatted current timestamp

I'm writing a policy to get current timestamp + 40 days (Ad password expiration policy) and set that into password expiration time in eDirectory.

If I want to set a static value in unix time formatted (e.g 1533895810) time in password expiration time, it's working and setting that value.
But our prime goal to make a unix time formatted value of current datetime + 40 days.
I have no idea how to do it using local variable.

1. First I require the current timestamp in unix format and set to a local variable
2. Next I want to add 40 days from that current timestamp
3. Get the time (current timestamp + 40 days in unix) and set it to password expiration time.
Labels (1)
0 Likes
1 Reply
Knowledge Partner
Knowledge Partner

Re: Not able to get unix time formatted current timestamp

On 8/10/2018 7:56 AM, indranil2121 wrote:
>
> I'm writing a policy to get current timestamp + 40 days (Ad password
> expiration policy) and set that into password expiration time in
> eDirectory.
>
> If I want to set a static value in unix time formatted (e.g 1533895810)
> time in password expiration time, it's working and setting that value.
> But our prime goal to make a unix time formatted value of current
> datetime + 40 days.
> I have no idea how to do it using local variable.
>
> 1. First I require the current timestamp in unix format and set to a
> local variable
> 2. Next I want to add 40 days from that current timestamp
> 3. Get the time (current timestamp + 40 days in unix) and set it to
> password expiration time.


IDM is nice in you have multiple tools to accomplish this task.

CTIME is great, since it is just a count of seconds.

So do it in XPATH. Once you have the time in a variable TIME, say, you
can set local variable TIME = XPath($TIME + 40*24*60*6)

Or since you likely are getting todays time, and adding 40 days, you
could use the convert time token, using its offset feature.

So it is abit odd, but you use the Convert Time on top of the Time token
to do it as below.


<do-set-local-variable name="TIME" scope="policy">
<arg-string>
<token-convert-time dest-format="!CTIME" dest-tz="UTC" offset="40"
offset-unit="day" src-format="!CTIME" src-tz="UTC">
<token-time format="!CTIME" tz="UTC"/>
</token-convert-time>
</arg-string>
</do-set-local-variable>


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.