I have a String that represents a time in Epoch and I need the correct format to be able to enter it into a SQL Server database, from PowerShell. So far I can change the Epoch format to a very long date format, EXAMPLE:
Date in Epoch to convert: 746181000
Function I use:
[timezone]::CurrentTimeZone.ToLocalTime(([datetime]'1/1/1970').AddSeconds('746181000'))
The output is as follows:
Tuesday, August 24, 1993 3:30:00 AM
What I really need is the date in this format: yyyy-MM-dd HH:MM:ss
So my desired output would be 1993-08-24 03:30:00