小编mrw*_*1t3的帖子

使用PowerShell转换Unix时间

我正在使用PowerShell SQLite模块解析SQLite数据库,并创建和修改了几个返回值,这两个值都在Unix时间.

我想做的是以某种方式将其转换为"人类时间".为了便于阅读,我删除了一些其他SQL查询.

Import-Module SQLite
mount-sqlite -name GoogleDrive -dataSource E:\Programming\new.db
$cloud_entry = Get-ChildItem GoogleDrive:\cloud_entry

foreach ($entry in $cloud_entry)
{
    $entry.created
}
Run Code Online (Sandbox Code Playgroud)

我选择了以下内容:

1337329458
Run Code Online (Sandbox Code Playgroud)

输出看起来像一大堆Unix时间戳:

$ctime = $entry.created
[datetime]$origin = '1970-01-01 00:00:00'
$origin.AddSeconds($ctime)
Run Code Online (Sandbox Code Playgroud)

powershell epoch unix-timestamp

7
推荐指数
5
解决办法
4万
查看次数

标签 统计

epoch ×1

powershell ×1

unix-timestamp ×1