一个将Unix时间转换为字符串的Powershell函数? [英] A Powershell function to convert unix time to string?

查看:66
本文介绍了一个将Unix时间转换为字符串的Powershell函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用ADO.NET和PowerShell阅读Firefox place.sqlite datedase的日期字段.

I'm trying to read the date fields of Firefox places.sqlite datedase using ADO.NET and PowerShell.

这些字段显然是在Unix时间.

Obviously these fields are in Unix time.

我正在寻找到.Net日期时间或字符串的转换

I'm looking for a conversion to .Net datetime or string

修改:我想将数据行绑定到WPF GridView.

I want to bind the datarow to a WPF GridView.

我需要一种在SQL查询中进行转换的方法,或者将数据行绑定到网格时的某种方法.

I need either a way to do the conversion within the SQL query or some way while binding the datarows to the grid.

推荐答案

像这样的事情应该使您走上正确的道路:

Something like this should put you on the right path:

[TimeZone]::CurrentTimeZone.ToLocalTime(([datetime]'1/1/1970').AddSeconds($unix))

这篇关于一个将Unix时间转换为字符串的Powershell函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆