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

Setting Up Python on a Windows Machine

# Install Visual C++ 14choco install vcredist2017 -y# Install Python 3.8choco install python --version=3.8 -y#…

PowerShell: Install PSTools

if(!(get-command psexec -ea SilentlyContinue)){ if (!(Get-Command choco.exe -ErrorAction SilentlyContinue)) { Set-ExecutionPolicy Bypass -Scope Process -Force;…

WordPress Plugin to Customize How Posts are Displayed

A. Install the 'Display Posts' plugin B. Install the 'Code Snippets' plugin C. Add this…