In Powershell, if I obtain DHCP leases from a server using Get-DHCPServerv4Lease
and then convert that to JSON, here is an example output:
....
"LeaseExpiryTime" : "\/Date(1457009853298)\/",
....
My question: What is that date number? Its not Unix timestamp or Windows filetime.
Unix TS: Thursday, October 20, 48140 11:14:58pm
Windows Filetime: Tuesday, January 2, 1601 4:28:21pm
The lease expiry time in the DHCP console is 3/3/2016 7:57:33 AM EST
. The best I've been able to come up with is chopping off the last three digits, which turns it into a proper Unix timestamp and gives me the correct time in UTC (my TZ is EST).
Of course, if I ConvertFrom-Json
I get a proper DateTime
object, albeit in UTC rather than EST:
$data | ConvertFrom-JSON
....
LeaseExpiryTime : 3/3/2016 12:57:33 PM
I can't seem to make a correct date using Get-Date
or even any methods in [DateTime]::
using that '1457009853298'
Running Get-Date | Convertto-JSON
gives me the below, but I still don't know what I can do with that value.
{
"value": "\/Date(1456939716572)\/",
"DisplayHint": 2,
"DateTime": "Wednesday, March 2, 2016 12:28:36 PM"
}