Posted On June 29, 2022

PowerShell: Converting Time Stamp from Int64 to DateTime and Vice Versa

kimconnect 0 comments
blog.KimConnect.com >> Codes >> PowerShell: Converting Time Stamp from Int64 to DateTime and Vice Versa

Here are some quick conversion methods between time values represented by Integer and DateTime data types:

# Convert from LastlogonTimeStamp to Date Time
[DateTime]::FromFileTime($_.LastLogon)
# Convert from DateTime to Lastlogon TimeStamp
$daysLimit=30
$limitTimestamp=(get-date).AddDays(-$daysLimit).ToFileTime()
$limitTimestamp.ToFileTime()

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

PowerShell: Adding a New Domain Controller

Error when trying to run DCPROMO on a Windows 2019 Server: ---------------------------Active Directory Domain Services…

PowerShell: Assign Guest Virtual Machine to a Cloud in VMM

# assignVmsToCloud.ps1 # version 0.02 # The following function assigns a guest VM into a…

Basic JavaScript: Manipulate Arrays With unshift()

// Setupvar myArray = [["John", 23], ["dog", 3]];myArray.shift();// Only change code below this line.myArray.unshift( ["Paul",35]);