Forum Discussion
Trying to convert pwdLastSet to Day Month Year Time format
I'm trying to take session.ad.last.attr.pwdLastSet and convert it to a more user-friendly readable format. I'm very weak on both Active Directory as well as Tcl.
Here's what I have so far:
if { [ACCESS::policy agent_id] eq "pwdLastSetCheck" } {
log local0. "Entered pwdLastSetCheck"
set pwdLastSet_epoch [ACCESS::session data get session.ad.last.attr.pwdLastSet]
log local0. "epoch time $pwdLastSet_epoch"
set clockFormat "[clock format $pwdLastSet_epoch]"
log local0. "formatted $clockFormat"
}
However my output looks like:
Apr 3 13:36:30 dmdc-f5-lab01 info tmm1[15679]: Rule /Common/cp_GenerateReset : Event Fired
Apr 3 13:36:30 dmdc-f5-lab01 info tmm1[15679]: Rule /Common/cp_GenerateReset : Entered pwdLastSetCheck
Apr 3 13:36:30 dmdc-f5-lab01 info tmm1[15679]: Rule /Common/cp_GenerateReset : epoch time 130722168433333201
Apr 3 13:36:30 dmdc-f5-lab01 info tmm1[15679]: Rule /Common/cp_GenerateReset : formatted Thu Jul 11 18:40:01 CDT -152544714
Any idea why my "year" looks like that? Or a better recommendation on how I should code this?
thanks in advance, Geoff
The time expected in clock cmd is in epoch. But AD returns in "Windows NT time" format. For the conversion, can try the following:
set clockFormat "[clock format [expr (($pwdLastSet_epoch / 10000000) - 11644473600)]]"
- kunjan_118660Cumulonimbus
The time expected in clock cmd is in epoch. But AD returns in "Windows NT time" format. For the conversion, can try the following:
set clockFormat "[clock format [expr (($pwdLastSet_epoch / 10000000) - 11644473600)]]"
- ge0ff73_32053NimbostratusThanks that was it!
- kunjanNimbostratus
The time expected in clock cmd is in epoch. But AD returns in "Windows NT time" format. For the conversion, can try the following:
set clockFormat "[clock format [expr (($pwdLastSet_epoch / 10000000) - 11644473600)]]"
- ge0ff73_32053NimbostratusThanks that was it!
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com