Search code examples
datetimepowershellado.netsqliteunix-timestamp

A Powershell function to convert unix time to string?


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

Obviously these fields are in Unix time.

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

Edit: I want to bind the datarow to a WPF GridView.

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


Solution

  • Something like this should put you on the right path:

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